Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

RAG Chatbot API connection error #803

Closed
amisskii opened this issue Oct 16, 2024 · 3 comments · Fixed by #810
Closed

RAG Chatbot API connection error #803

amisskii opened this issue Oct 16, 2024 · 3 comments · Fixed by #810

Comments

@amisskii
Copy link

amisskii commented Oct 16, 2024

The RAG chatbot throws an API connection error.

AI lab extension version: 1.3.1
OS: Fedora 40
Image

Log output:

File "/opt/app-root/lib64/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
    exec(code, module.__dict__)
File "/rag/rag_app.py", line 101, in <module>
    response = chain.invoke(prompt)
               ^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/runnables/base.py", line 2499, in invoke
    input = step.invoke(
            ^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 158, in invoke
    self.generate_prompt(
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 560, in generate_prompt
    return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 421, in generate
    raise e
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 411, in generate
    self._generate_with_cache(
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 632, in _generate_with_cache
    result = self._generate(
             ^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_openai/chat_models/base.py", line 519, in _generate
    return generate_from_stream(stream_iter)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/language_models/chat_models.py", line 67, in generate_from_stream
    for chunk in stream:
File "/opt/app-root/lib64/python3.11/site-packages/langchain_openai/chat_models/base.py", line 480, in _stream
    with self.client.create(messages=message_dicts, **params) as response:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/openai/_utils/_utils.py", line 274, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/openai/resources/chat/completions.py", line 742, in create
    return self._post(
           ^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/openai/_base_client.py", line 1277, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/openai/_base_client.py", line 954, in request
    return self._request(
           ^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/openai/_base_client.py", line 1014, in _request
    return self._retry_request(
           ^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/openai/_base_client.py", line 1092, in _retry_request
    return self._request(
           ^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/openai/_base_client.py", line 1014, in _request
    return self._retry_request(
           ^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/openai/_base_client.py", line 1092, in _retry_request
    return self._request(
           ^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/openai/_base_client.py", line 1024, in _request
    raise APIConnectionError(request=request) from err
@amisskii amisskii changed the title RAG Chatbot errors RAG Chatbot fails Oct 16, 2024
@amisskii amisskii changed the title RAG Chatbot fails RAG Chatbot throws an error Oct 16, 2024
@amisskii amisskii changed the title RAG Chatbot throws an error RAG Chatbot API connection error Oct 16, 2024
@jeffmaury
Copy link
Collaborator

Cannot reproduce on my environment: Win11Pro/WSL

@klawrenc
Copy link

klawrenc commented Nov 4, 2024

I get the same issue on my M3, this RAG demo worked fine several weeks ago

Exception: {"error":"InvalidArgumentError","message":"Expected where to have exactly one operator, got {}"} (trace ID: 0)
Traceback:
File "/opt/app-root/lib64/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 600, in _run_script
exec(code, module.dict)
File "/rag/rag_app.py", line 101, in
response = chain.invoke(prompt)
^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/runnables/base.py", line 2499, in invoke
input = step.invoke(
^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/runnables/base.py", line 3142, in invoke
output = {key: future.result() for key, future in zip(steps, futures)}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/runnables/base.py", line 3142, in
output = {key: future.result() for key, future in zip(steps, futures)}
^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/lib64/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/retrievers.py", line 194, in invoke
return self.get_relevant_documents(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/_api/deprecation.py", line 148, in warning_emitting_wrapper
return wrapped(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/retrievers.py", line 323, in get_relevant_documents
raise e
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/retrievers.py", line 316, in get_relevant_documents
result = self._get_relevant_documents(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/vectorstores.py", line 696, in _get_relevant_documents
docs = self.vectorstore.similarity_search(query, **self.search_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_community/vectorstores/chroma.py", line 349, in similarity_search
docs_and_scores = self.similarity_search_with_score(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_community/vectorstores/chroma.py", line 439, in similarity_search_with_score
results = self.__query_collection(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_core/utils/utils.py", line 36, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/langchain_community/vectorstores/chroma.py", line 156, in __query_collection
return self._collection.query(
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/chromadb/api/models/Collection.py", line 197, in query
query_results = self._client._query(
^^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/chromadb/telemetry/opentelemetry/init.py", line 146, in wrapper
return f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/chromadb/api/fastapi.py", line 500, in _query
resp_json = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/opt/app-root/lib64/python3.11/site-packages/chromadb/api/fastapi.py", line 89, in _make_request
BaseHTTPClient._raise_chroma_error(response)
File "/opt/app-root/lib64/python3.11/site-packages/chromadb/api/base_http_client.py", line 103, in _raise_chroma_error
raise Exception(f"{resp.text} (trace ID: {trace_id})")

@slemeur
Copy link

slemeur commented Nov 4, 2024

I can reproduce the error as well

rhatdan added a commit that referenced this issue Nov 15, 2024
fix: use Chroma 0.5.16 as this is the last one working with the RAG r…
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants