langchain-ai / langgraph

Build resilient language agents as graphs.
https://langchain-ai.github.io/langgraph/
MIT License
5.29k stars 832 forks source link

DOC: Agent supervisor error after Changing ChatOpenAi #373

Open SatouKuzuma1 opened 3 months ago

SatouKuzuma1 commented 3 months ago

Issue with current documentation:

I'm trying to run the agent-supervisor example. I've change the ChatOpenAi to ChatGroq and And also the tavily tool for the python_repl_tool instead and I'm getting an error, which I think it comes from the create_openai_tools_agent()

This is the error I'm getting:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[28], [line 1](vscode-notebook-cell:?execution_count=28&line=1)
----> [1](vscode-notebook-cell:?execution_count=28&line=1) for s in graph.stream(
      [2](vscode-notebook-cell:?execution_count=28&line=2)     {
      [3](vscode-notebook-cell:?execution_count=28&line=3)         "messages": [
      [4](vscode-notebook-cell:?execution_count=28&line=4)             HumanMessage(content="Code hello world and print it to the terminal")
      [5](vscode-notebook-cell:?execution_count=28&line=5)         ]
      [6](vscode-notebook-cell:?execution_count=28&line=6)     }
      [7](vscode-notebook-cell:?execution_count=28&line=7) ):
      [8](vscode-notebook-cell:?execution_count=28&line=8)     if "__end__" not in s:
      [9](vscode-notebook-cell:?execution_count=28&line=9)         print(s)

File [~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:710](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:710), in Pregel.stream(self, input, config, stream_mode, output_keys, input_keys, interrupt_before, interrupt_after, debug)
    [703](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:703) done, inflight = concurrent.futures.wait(
    [704](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:704)     futures,
    [705](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:705)     return_when=concurrent.futures.FIRST_EXCEPTION,
    [706](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:706)     timeout=self.step_timeout,
    [707](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:707) )
    [709](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:709) # panic on failure or timeout
--> [710](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:710) _panic_or_proceed(done, inflight, step)
    [712](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:712) # combine pending writes from all tasks
    [713](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:713) pending_writes = deque[tuple[str, Any]]()

File [~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:1126](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langgraph/pregel/__init__.py:1126), in _panic_or_proceed(done, inflight, step)
...
    [241](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langchain_groq/chat_models.py:241) }
--> [242](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langchain_groq/chat_models.py:242) response = self.client.create(messages=message_dicts, **params)
    [243](https://file+.vscode-resource.vscode-cdn.net/Users/ruben/Desktop/Python/pdf/local-model/notebooks/~/Desktop/Python/pdf/local-model/.venv/lib/python3.10/site-packages/langchain_groq/chat_models.py:243) return self._create_chat_result(response)

TypeError: Completions.create() got an unexpected keyword argument 'functions'
Output is truncated. View as a [scrollable element](command:cellOutput.enableScrolling?d4edf1e0-942d-4502-98e6-8fe38e079a64) or open in a [text editor](command:workbench.action.openLargeOutput?d4edf1e0-942d-4502-98e6-8fe38e079a64). Adjust cell output [settings](command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D)...

I've tried to use other functions like create_structured_chat_agent but I've got different errors. This time when trying to compile the graph, says

ValueError: Prompt missing required variables: {'tools', 'tool_names'}
Output is truncated. View as a [scrollable element](command:cellOutput.enableScrolling?9154a43a-66ac-4161-8429-870a95e44a24) or open in a [text editor](command:workbench.action.openLargeOutput?9154a43a-66ac-4161-8429-870a95e44a24). Adjust cell output [settings](command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D)...

Idea or request for content:

Diferent Implementations with open source Chat models like ChatGroq or ChatOllama

hinthornw commented 3 months ago

Does this persist after you update langchain-groq

SatouKuzuma1 commented 3 months ago

@hinthornw Yes, it persist. Current langchain-groq version==0.1.3