Spaces:
Sleeping
Sleeping
Commit ·
68d30bd
1
Parent(s): 8a59e4b
reduce gemini usage and add fallback
Browse files- back_end/agent/graph.py +11 -5
back_end/agent/graph.py
CHANGED
|
@@ -54,9 +54,9 @@ def _tiktoken_counter(messages):
|
|
| 54 |
def initialize_agent(is_vector_db_created: bool, tools: list):
|
| 55 |
# llm = ChatGoogleGenerativeAI( model="gemini-3.1-flash-lite-preview",temperature=0 )
|
| 56 |
llm = ChatGoogleGenerativeAI(
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
)
|
| 60 |
llm_with_tools = llm.bind_tools(tools)
|
| 61 |
|
| 62 |
message_trimmer = trim_messages(
|
|
@@ -107,8 +107,14 @@ class SupervisorDecision(BaseModel):
|
|
| 107 |
|
| 108 |
def initialize_supervisor():
|
| 109 |
|
| 110 |
-
powerful_llm = ChatGoogleGenerativeAI(
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
def supervisor_node(state: MessagesState):
|
| 114 |
# Calculate iteration count based on previous feedback messages
|
|
|
|
| 54 |
def initialize_agent(is_vector_db_created: bool, tools: list):
|
| 55 |
# llm = ChatGoogleGenerativeAI( model="gemini-3.1-flash-lite-preview",temperature=0 )
|
| 56 |
llm = ChatGoogleGenerativeAI(
|
| 57 |
+
model="gemini-1.5-flash",
|
| 58 |
+
temperature=0
|
| 59 |
+
)
|
| 60 |
llm_with_tools = llm.bind_tools(tools)
|
| 61 |
|
| 62 |
message_trimmer = trim_messages(
|
|
|
|
| 107 |
|
| 108 |
def initialize_supervisor():
|
| 109 |
|
| 110 |
+
powerful_llm = ChatGoogleGenerativeAI(
|
| 111 |
+
model="gemini-1.5-flash",
|
| 112 |
+
temperature=0.2
|
| 113 |
+
)
|
| 114 |
+
|
| 115 |
+
powerful_agent = powerful_llm.with_structured_output(
|
| 116 |
+
SupervisorDecision
|
| 117 |
+
)
|
| 118 |
|
| 119 |
def supervisor_node(state: MessagesState):
|
| 120 |
# Calculate iteration count based on previous feedback messages
|