Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,8 @@ import gradio as gr
|
|
3 |
import requests
|
4 |
import pandas as pd
|
5 |
from dotenv import load_dotenv
|
6 |
-
from
|
|
|
7 |
|
8 |
# Load environment variables
|
9 |
load_dotenv()
|
@@ -14,13 +15,7 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
14 |
# --- Basic Agent Definition ---
|
15 |
class BasicAgent:
|
16 |
def __init__(self):
|
17 |
-
self.llm =
|
18 |
-
model="gemini-2.0-flash",
|
19 |
-
temperature=0.1,
|
20 |
-
max_tokens=1024,
|
21 |
-
api_key=os.getenv("GOOGLE_API_KEY"),
|
22 |
-
streaming=False # Set to True if you want streaming output
|
23 |
-
)
|
24 |
self.instructions = """You are a helpful assistant. For every question, reply with only the answer—no explanation, "
|
25 |
"no units, and no extra words. If the answer is a number, just return the number. "
|
26 |
"If it is a word or phrase, return only that. If it is a list, return a comma-separated list with no extra words. "
|
|
|
3 |
import requests
|
4 |
import pandas as pd
|
5 |
from dotenv import load_dotenv
|
6 |
+
from langchain_openai import ChatOpenAI
|
7 |
+
from langchain_nvidia_ai_endpoints import ChatNVIDIA
|
8 |
|
9 |
# Load environment variables
|
10 |
load_dotenv()
|
|
|
15 |
# --- Basic Agent Definition ---
|
16 |
class BasicAgent:
|
17 |
def __init__(self):
|
18 |
+
self.llm = ChatOpenAI(model="gpt-4o-mini",streaming=False,base_url="https://aiproxy.sanand.workers.dev/openai/v1",api_key=os.getenv("AIPROXY_TOKEN"))
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
self.instructions = """You are a helpful assistant. For every question, reply with only the answer—no explanation, "
|
20 |
"no units, and no extra words. If the answer is a number, just return the number. "
|
21 |
"If it is a word or phrase, return only that. If it is a list, return a comma-separated list with no extra words. "
|