Skip to content

Local LangGraph RAG agent with Llama 3 error #894

@IgorKasianenko

Description

@IgorKasianenko

Deprecated function throws error

Information

  • The official example scripts
  • My own modified scripts

🐛 Describe the bug

Notebook 3p-integrations/langchain/langgraph_rag_agent_local.ipynb in the cell when run on GPU machine or in Colab

# LLM
llm = ChatOllama(model=local_llm, format="json", temperature=0)

...

retrieval_grader = prompt | llm | JsonOutputParser()
question = "agent memory"
docs = retriever.invoke(question)
doc_txt = docs[1].page_content
print(retrieval_grader.invoke({"question": question, "document": doc_txt}))

Error logs

<ipython-input-5-e076046ccc4a>:8: LangChainDeprecationWarning: The class `ChatOllama` was deprecated in LangChain 0.3.1 and will be removed in 1.0.0. An updated version of the class exists in the :class:`~langchain-ollama package and should be used instead. To use it run `pip install -U :class:`~langchain-ollama` and import as `from :class:`~langchain_ollama import ChatOllama``.
  llm = ChatOllama(model=local_llm, format="json", temperature=0)
---------------------------------------------------------------------------
ConnectionRefusedError                    Traceback (most recent call last)
[/usr/local/lib/python3.11/dist-packages/urllib3/connection.py](https://localhost:8080/#) in _new_conn(self)
    197         try:
--> 198             sock = connection.create_connection(
    199                 (self._dns_host, self.port),

27 frames
ConnectionRefusedError: [Errno 111] Connection refused

The above exception was the direct cause of the following exception:

NewConnectionError                        Traceback (most recent call last)
NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7a106ccf5390>: Failed to establish a new connection: [Errno 111] Connection refused

The above exception was the direct cause of the following exception:

MaxRetryError                             Traceback (most recent call last)
MaxRetryError: HTTPConnectionPool(host='localhost', port=11434): Max retries exceeded with url: /api/chat (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7a106ccf5390>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

ConnectionError                           Traceback (most recent call last)
[/usr/local/lib/python3.11/dist-packages/requests/adapters.py](https://localhost:8080/#) in send(self, request, stream, timeout, verify, cert, proxies)
    698                 raise SSLError(e, request=request)
    699 
--> 700             raise ConnectionError(e, request=request)
    701 
    702         except ClosedPoolError as e:

ConnectionError: HTTPConnectionPool(host='localhost', port=11434): Max retries exceeded with url: /api/chat (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7a106ccf5390>: Failed to establish a new connection: [Errno 111] Connection refused'))

Expected behavior

Running end to end without errors

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions