Spaces:
Sleeping
Sleeping
changed model
Browse files
app.py
CHANGED
|
@@ -10,6 +10,10 @@ from smolagents import CodeAgent, DuckDuckGoSearchTool, OpenAIServerModel, LiteL
|
|
| 10 |
# --- Constants ---
|
| 11 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# --- Basic Agent Definition ---
|
| 14 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 15 |
class BasicAgent:
|
|
@@ -17,7 +21,7 @@ class BasicAgent:
|
|
| 17 |
print("Initializing the BasicAgent")
|
| 18 |
# model = OpenAIServerModel(model_id="gpt-4o")
|
| 19 |
# model = OpenAIServerModel(model_id="gpt-4o-mini")
|
| 20 |
-
model = OpenAIServerModel(model_id="o1-mini")
|
| 21 |
# google_api_key = os.getenv('GOOGLE_API_KEY')
|
| 22 |
# if google_api_key:
|
| 23 |
# print(f"GOOGLE_API_KEY found. Last 10 characters: ...{google_api_key[-10:]}")
|
|
@@ -35,6 +39,17 @@ class BasicAgent:
|
|
| 35 |
# print("and that your GOOGLE_API_KEY environment variable is set.")
|
| 36 |
# raise e # Re-raise the exception to fail initialization if model fails
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
# Initialize the search tool
|
| 39 |
search_tool = DuckDuckGoSearchTool()
|
| 40 |
print("DuckDuckSearchTool instantiated")
|
|
|
|
| 10 |
# --- Constants ---
|
| 11 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 12 |
|
| 13 |
+
from langchain_openai import AzureChatOpenAI
|
| 14 |
+
|
| 15 |
+
load_dotenv()
|
| 16 |
+
|
| 17 |
# --- Basic Agent Definition ---
|
| 18 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 19 |
class BasicAgent:
|
|
|
|
| 21 |
print("Initializing the BasicAgent")
|
| 22 |
# model = OpenAIServerModel(model_id="gpt-4o")
|
| 23 |
# model = OpenAIServerModel(model_id="gpt-4o-mini")
|
| 24 |
+
# model = OpenAIServerModel(model_id="o1-mini")
|
| 25 |
# google_api_key = os.getenv('GOOGLE_API_KEY')
|
| 26 |
# if google_api_key:
|
| 27 |
# print(f"GOOGLE_API_KEY found. Last 10 characters: ...{google_api_key[-10:]}")
|
|
|
|
| 39 |
# print("and that your GOOGLE_API_KEY environment variable is set.")
|
| 40 |
# raise e # Re-raise the exception to fail initialization if model fails
|
| 41 |
|
| 42 |
+
model = AzureChatOpenAI(
|
| 43 |
+
azure_endpoint=os.getenv("AZURE_API_ENDPOINT"),
|
| 44 |
+
azure_deployment=os.getenv("AZURE_DEPLOYMENT_NME"), # or your deployment
|
| 45 |
+
api_key=os.getenv("AZURE_OPENAI_KEY"),
|
| 46 |
+
api_version=os.getenv("AZURE_API_VERSION"),
|
| 47 |
+
temperature=0.5,
|
| 48 |
+
max_tokens=None,
|
| 49 |
+
timeout=None,
|
| 50 |
+
max_retries=2,
|
| 51 |
+
)
|
| 52 |
+
|
| 53 |
# Initialize the search tool
|
| 54 |
search_tool = DuckDuckGoSearchTool()
|
| 55 |
print("DuckDuckSearchTool instantiated")
|