Update agents/agents_nodes.py
Browse files- agents/agents_nodes.py +9 -1
agents/agents_nodes.py
CHANGED
|
@@ -31,13 +31,21 @@ llm = HuggingFacePipeline(pipeline=text_generator)
|
|
| 31 |
# tool_choice={"type": "function", "function": {"name": "time_value_tool"}}
|
| 32 |
# )
|
| 33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
llm_instantiated = llm | RunnableLambda(
|
| 35 |
-
lambda x: x.
|
| 36 |
[time_value_tool],
|
| 37 |
tool_choice={"type": "function", "function": {"name": "time_value_tool"}}
|
| 38 |
)
|
| 39 |
)
|
| 40 |
|
|
|
|
| 41 |
def agent_node(state: AgentState):
|
| 42 |
response = llm_instantiated.invoke(state["messages"])
|
| 43 |
if not (hasattr(response, 'tool_calls') and response.tool_calls):
|
|
|
|
| 31 |
# tool_choice={"type": "function", "function": {"name": "time_value_tool"}}
|
| 32 |
# )
|
| 33 |
|
| 34 |
+
# llm_instantiated = llm | RunnableLambda(
|
| 35 |
+
# lambda x: x.bind_tools(
|
| 36 |
+
# [time_value_tool],
|
| 37 |
+
# tool_choice={"type": "function", "function": {"name": "time_value_tool"}}
|
| 38 |
+
# )
|
| 39 |
+
# )
|
| 40 |
+
|
| 41 |
llm_instantiated = llm | RunnableLambda(
|
| 42 |
+
lambda x: x.bind(
|
| 43 |
[time_value_tool],
|
| 44 |
tool_choice={"type": "function", "function": {"name": "time_value_tool"}}
|
| 45 |
)
|
| 46 |
)
|
| 47 |
|
| 48 |
+
|
| 49 |
def agent_node(state: AgentState):
|
| 50 |
response = llm_instantiated.invoke(state["messages"])
|
| 51 |
if not (hasattr(response, 'tool_calls') and response.tool_calls):
|