Skip to content

Commit

Permalink
doc: Add TODO comments for bind tools and automatic function calling.
Browse files Browse the repository at this point in the history
  • Loading branch information
anubhav756 committed Nov 19, 2024
1 parent 23f1707 commit 5e1c26d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def initialize_agent(
prompt: ChatPromptTemplate,
model: str,
) -> "UserAgent":
# TODO: Use .bind_tools(tools) to bind the tools with the LLM.
llm = ChatVertexAI(max_output_tokens=512, model_name=model, temperature=0.0)
llm.bind_tools(tools)
memory = ConversationBufferMemory(
chat_memory=ChatMessageHistory(messages=history),
memory_key="chat_history",
Expand Down
5 changes: 5 additions & 0 deletions llm_demo/orchestrator/langgraph/react_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ async def create_graph(
tool_node = ToolNode(tools)

# model node
# TODO: Use .bind_tools(tools) to bind the tools with the LLM.
model = ChatVertexAI(max_output_tokens=512, model_name=model_name, temperature=0.0)

# Add the prompt to the model to create a model runnable
Expand All @@ -98,6 +99,10 @@ async def acall_model(state: UserState, config: RunnableConfig):
messages = state["messages"]
res = await model_runnable.ainvoke({"messages": messages}, config)

# TODO: Remove the temporary fix of parsing LLM response and invoking
# tools until we use bind_tools API and have automatic response parsing
# and tool calling. (see
# https://langchain-ai.github.io/langgraph/#example)
if "```json" in res.content:
try:
response = str(res.content).replace("```json", "").replace("```", "")
Expand Down

0 comments on commit 5e1c26d

Please sign in to comment.