Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os
|
|
|
|
| 2 |
import regex as re
|
| 3 |
import gradio as gr
|
| 4 |
import requests
|
|
@@ -13,14 +14,23 @@ from langchain.tools import Tool
|
|
| 13 |
from langgraph.graph import START, StateGraph
|
| 14 |
from langgraph.graph.message import add_messages
|
| 15 |
from langgraph.prebuilt import ToolNode, tools_condition
|
| 16 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
print("Loading LLM...")
|
| 20 |
-
ollama.pull('gemma3:4b')
|
| 21 |
-
chat = ChatOllama(model="gemma3:4b", verbose=True)
|
| 22 |
print(f"Model {chat.model} downloaded!")
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
# (Keep Constants as is)
|
| 25 |
# --- Constants ---
|
| 26 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
|
| 1 |
import os
|
| 2 |
+
import getpass
|
| 3 |
import regex as re
|
| 4 |
import gradio as gr
|
| 5 |
import requests
|
|
|
|
| 14 |
from langgraph.graph import START, StateGraph
|
| 15 |
from langgraph.graph.message import add_messages
|
| 16 |
from langgraph.prebuilt import ToolNode, tools_condition
|
| 17 |
+
from langchain.chat_models import init_chat_model
|
| 18 |
+
from langchain_mistralai import ChatMistralAI
|
| 19 |
+
from mistralai import Mistral
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
import getpass
|
| 23 |
+
import os
|
| 24 |
+
|
| 25 |
+
if "Mistral" not in os.environ:
|
| 26 |
+
os.environ["Mistral"] = getpass.getpass("Enter your Mistral API key: ")
|
| 27 |
|
| 28 |
|
| 29 |
print("Loading LLM...")
|
|
|
|
|
|
|
| 30 |
print(f"Model {chat.model} downloaded!")
|
| 31 |
+
chat = ChatMistralAI(
|
| 32 |
+
model="mistral-large-latest", mistral_api_key=os.getenv["Mistral"]
|
| 33 |
+
)
|
| 34 |
# (Keep Constants as is)
|
| 35 |
# --- Constants ---
|
| 36 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|