Spaces:
Runtime error
Runtime error
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -697,44 +697,43 @@ def get_youtube_transcript(url: str) -> str:
|
|
| 697 |
except:
|
| 698 |
pass
|
| 699 |
|
|
|
|
|
|
|
|
|
|
| 700 |
class BasicAgent:
|
| 701 |
def __init__(self):
|
| 702 |
print("BasicAgent initialized.")
|
| 703 |
-
# Initialize
|
| 704 |
-
# Standard model for supervisor and validator
|
| 705 |
self.langfuse_handler = CallbackHandler()
|
| 706 |
|
| 707 |
-
|
| 708 |
-
|
| 709 |
-
|
| 710 |
-
|
| 711 |
-
temperature=0.
|
| 712 |
-
|
| 713 |
-
# "type": "enabled",
|
| 714 |
-
# "budget_tokens": 5000
|
| 715 |
-
# }
|
| 716 |
)
|
| 717 |
|
| 718 |
-
#
|
| 719 |
-
self.validator_model =
|
| 720 |
-
|
| 721 |
-
|
| 722 |
-
temperature=0.5,
|
| 723 |
-
|
| 724 |
)
|
| 725 |
|
| 726 |
-
#
|
| 727 |
-
self.worker_model_base =
|
| 728 |
-
|
| 729 |
-
|
| 730 |
temperature=0.75,
|
| 731 |
-
|
| 732 |
)
|
| 733 |
|
| 734 |
-
#
|
| 735 |
-
self.tools = [search_web_tavily, search_web_serper, execute_code_securely,
|
| 736 |
-
|
| 737 |
-
|
| 738 |
self.worker_model = self.worker_model_base.bind_tools(self.tools)
|
| 739 |
|
| 740 |
# Create the tool node for executing tools
|
|
|
|
| 697 |
except:
|
| 698 |
pass
|
| 699 |
|
| 700 |
+
from litellm import LiteLLMModel
|
| 701 |
+
import os
|
| 702 |
+
|
| 703 |
class BasicAgent:
|
| 704 |
def __init__(self):
|
| 705 |
print("BasicAgent initialized.")
|
| 706 |
+
# Initialize callback handler
|
|
|
|
| 707 |
self.langfuse_handler = CallbackHandler()
|
| 708 |
|
| 709 |
+
# Supervisor model using Gemini
|
| 710 |
+
self.supervisor_model = LiteLLMModel(
|
| 711 |
+
model_id="gemini/gemini-2.0-flash-lite",
|
| 712 |
+
api_key=os.getenv("GEMINI_API_KEY"),
|
| 713 |
+
temperature=0.5,
|
| 714 |
+
max_tokens=1024,
|
|
|
|
|
|
|
|
|
|
| 715 |
)
|
| 716 |
|
| 717 |
+
# Validator model using Gemini
|
| 718 |
+
self.validator_model = LiteLLMModel(
|
| 719 |
+
model_id="gemini/gemini-2.0-flash-lite",
|
| 720 |
+
api_key=os.getenv("GEMINI_API_KEY"),
|
| 721 |
+
temperature=0.5,
|
| 722 |
+
max_tokens=1024,
|
| 723 |
)
|
| 724 |
|
| 725 |
+
# Worker base model using Gemini
|
| 726 |
+
self.worker_model_base = LiteLLMModel(
|
| 727 |
+
model_id="gemini/gemini-2.0-flash-lite",
|
| 728 |
+
api_key=os.getenv("GEMINI_API_KEY"),
|
| 729 |
temperature=0.75,
|
| 730 |
+
max_tokens=20000,
|
| 731 |
)
|
| 732 |
|
| 733 |
+
# Bind tools to the worker model
|
| 734 |
+
self.tools = [search_web_tavily, search_web_serper, execute_code_securely,
|
| 735 |
+
execute_shell_command, sandbox_file_operation, extract_document_data,
|
| 736 |
+
extract_image_data, extract_url_content, get_youtube_transcript]
|
| 737 |
self.worker_model = self.worker_model_base.bind_tools(self.tools)
|
| 738 |
|
| 739 |
# Create the tool node for executing tools
|