|
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() |
|
|