File size: 732 Bytes
35770a6
 
 
 
3347875
35770a6
 
 
 
 
 
 
 
 
3347875
35770a6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3347875
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from mistralai import Mistral
import gradio as gr
import os
from dotenv import load_dotenv
import time

load_dotenv()

api_key = os.getenv("MISTRAL_API_KEY")

client = Mistral(api_key=api_key)


def echo(message, history):
    time.sleep(1.1)
    chat_response = client.agents.complete(
        agent_id="ag:4b4eaa5c:20250427:untitled-agent:27ff0afd",
        messages=[
            {
                "role": "user",
                "content": message,
            }
        ],
    )
    return chat_response.choices[0].message.content


demo = gr.ChatInterface(
    fn=echo,
    type="messages",
    examples=["Hello, how's your day?", "I love the weather today"],
    title="Fined Tuned LLM with Reddit Comments",
)
demo.launch()