Giter Club home page Giter Club logo

chat-with-pdf-chatbot's Introduction

Chat-with-PDF-Chatbot

This Chatbot is an interactive app developed to assist users to interact with their PDF. It is built using Open Source Stack. No OpenAI is required.

Getting Started

Follow these steps to set up and run the project on your local machine.

Installation

## Clone the repository
git clone <repository_url>

## Create the necessary folders
mkdir db
mkdir models
## Add your model files to the 'models' folder
mkdir docs

----
### Usage 

## Run the ingestion script to prepare the data

`python ingest.py`

## Start the chatbot application using Streamlit

`streamlit run chatbot_app.py`

chat-with-pdf-chatbot's People

Contributors

aianytime avatar manas95826 avatar manjunathshiva avatar zaheer-10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

chat-with-pdf-chatbot's Issues

UnboundLocalError

Traceback (most recent call last):
File "/content/Chat-with-PDF-Chatbot/ingest.py", line 32, in
main()
File "/content/Chat-with-PDF-Chatbot/ingest.py", line 16, in main
documents = loader.load()
UnboundLocalError: local variable 'loader' referenced before assignment

cannot import name 'SentenceTransformerEmbeddings'

Traceback (most recent call last):
File "/Volumes/2TBNVMeM2/downloads-2TB/code-repos/app-pdf-anytime/Chat-with-PDF-Chatbot/ingest.py", line 3, in
from langchain.embeddings import SentenceTransformerEmbeddings
ImportError: cannot import name 'SentenceTransformerEmbeddings' from 'langchain.embeddings' (/opt/anaconda3/lib/python3.9/site-packages/langchain/embeddings/init.py)

attribute erroe

i have cloned the repo and tried to use it i get attribute error Traceback (most recent call last):
File "d:\SFTP\lambdademo\Chat-with-PDF-Chatbot\chatbot_app.py", line 25, in
base_model = AutoModelForSeq2SeqLM.from_pretrained(
File "C:\Users\JAYASHEELI\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\models\auto\auto_factory.py", line 467, in from_pretrained
return model_class.from_pretrained(
File "C:\Users\JAYASHEELI\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\modeling_utils.py", line 2777, in from_pretrained
) = cls._load_pretrained_model(
File "C:\Users\JAYASHEELI\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\modeling_utils.py", line 2865, in _load_pretrained_model
if device_map is not None and "disk" in device_map.values():
AttributeError: 'torch.device' object has no attribute 'values'

TypeError: _process_class() missing 4 required positional arguments: 'match_args', 'kw_only', 'slots', and 'weakref_slot'

While importing :

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

Gives error:

File "/opt/conda/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
    exec(code, module.__dict__)
File "/workspaces/Chat-with-PDF-Chatbot/chatbot_app.py", line 5, in <module>
    from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
File "/opt/conda/lib/python3.11/site-packages/transformers/__init__.py", line 26, in <module>
    from . import dependency_versions_check
File "/opt/conda/lib/python3.11/site-packages/transformers/dependency_versions_check.py", line 16, in <module>
    from .utils.versions import require_version, require_version_core
File "/opt/conda/lib/python3.11/site-packages/transformers/utils/__init__.py", line 60, in <module>
    from .hub import (
File "/opt/conda/lib/python3.11/site-packages/transformers/utils/hub.py", line 32, in <module>
    from huggingface_hub import (
File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
File "/opt/conda/lib/python3.11/site-packages/huggingface_hub/__init__.py", line 370, in __getattr__
    submod = importlib.import_module(submod_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.11/site-packages/huggingface_hub/hf_api.py", line 62, in <module>
    from ._inference_endpoints import InferenceEndpoint, InferenceEndpointType
File "/opt/conda/lib/python3.11/site-packages/huggingface_hub/_inference_endpoints.py", line 7, in <module>
    from .inference._client import InferenceClient
File "/opt/conda/lib/python3.11/site-packages/huggingface_hub/inference/_client.py", line 56, in <module>
    from huggingface_hub.inference._common import (
File "/opt/conda/lib/python3.11/site-packages/huggingface_hub/inference/_common.py", line 51, in <module>
    from ._text_generation import TextGenerationStreamResponse, _parse_text_generation_error
File "/opt/conda/lib/python3.11/site-packages/huggingface_hub/inference/_text_generation.py", line 59, in <module>
    @dataclass
     ^^^^^^^^^
File "/opt/conda/lib/python3.11/site-packages/pydantic/dataclasses.py", line 137, in dataclass
    return wrap(_cls)
           ^^^^^^^^^^
File "/opt/conda/lib/python3.11/site-packages/pydantic/dataclasses.py", line 132, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen, config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.11/site-packages/pydantic/dataclasses.py", line 84, in _process_class
    cls = dataclasses._process_class(_cls, init, repr, eq, order, unsafe_hash, frozen)  # type: ignore
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Repository Not Found for url: https://huggingface.co/LaMini-T5-738M/resolve/main/tokenizer_config.json

chatbot_app.py fails with Repository Not Found error

Checkpoint path: LaMini-T5-738M
2023-09-02 20:26:48.175 Uncaught app exception
Traceback (most recent call last):
File "/Users/manju/.pyenv/versions/3.11.4/lib/python3.11/site-packages/huggingface_hub/utils/_errors.py", line 261, in hf_raise_for_status
response.raise_for_status()
File "/Users/manju/.pyenv/versions/3.11.4/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/LaMini-T5-738M/resolve/main/tokenizer_config.json

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

Traceback (most recent call last):
File "/Users/manju/.pyenv/versions/3.11.4/lib/python3.11/site-packages/transformers/utils/hub.py", line 417, in cached_file
resolved_file = hf_hub_download(
^^^^^^^^^^^^^^^^
File "/Users/manju/.pyenv/versions/3.11.4/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/Users/manju/.pyenv/versions/3.11.4/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 1195, in hf_hub_download
metadata = get_hf_file_metadata(
^^^^^^^^^^^^^^^^^^^^^
File "/Users/manju/.pyenv/versions/3.11.4/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 118, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/Users/manju/.pyenv/versions/3.11.4/lib/python3.11/site-packages/huggingface_hub/file_download.py", line 1541, in get_hf_file_metadata
hf_raise_for_status(r)
File "/Users/manju/.pyenv/versions/3.11.4/lib/python3.11/site-packages/huggingface_hub/utils/_errors.py", line 293, in hf_raise_for_status
raise RepositoryNotFoundError(message, response) from e
huggingface_hub.utils._errors.RepositoryNotFoundError: 404 Client Error. (Request ID: Root=1-64f34d30-79e7e3f07c70fbc373db2408;776bd98a-0641-401c-b00e-bde06265e92c)

Repository Not Found for url: https://huggingface.co/LaMini-T5-738M/resolve/main/tokenizer_config.json.
Please make sure you specified the correct repo_id and repo_type.
If you are trying to access a private or gated repo, make sure you are authenticated.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/manju/.pyenv/versions/3.11.4/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.dict)
File "/Volumes/FastSSD2/LLM/AIAnytime/Chat-with-PDF-Chatbot/chatbot_app.py", line 24, in
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/manju/.pyenv/versions/3.11.4/lib/python3.11/site-packages/transformers/models/auto/tokenization_auto.py", line 652, in from_pretrained
tokenizer_config = get_tokenizer_config(pretrained_model_name_or_path, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/manju/.pyenv/versions/3.11.4/lib/python3.11/site-packages/transformers/models/auto/tokenization_auto.py", line 496, in get_tokenizer_config
resolved_config_file = cached_file(
^^^^^^^^^^^^
File "/Users/manju/.pyenv/versions/3.11.4/lib/python3.11/site-packages/transformers/utils/hub.py", line 433, in cached_file
raise EnvironmentError(
OSError: LaMini-T5-738M is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'
If this is a private repository, make sure to pass a token having permission to this repo with use_auth_token or log in with huggingface-cli login and pass use_auth_token=True.

AttributeError: 'Client' object has no attribute 'chroma_api_impl'

AttributeError: 'Client' object has no attribute 'chroma_api_impl'
Traceback:
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 584, in _run_script
exec(code, module.dict)
File "C:\Users\Admin\Desktop\ragwithurb\7urb.py", line 194, in
main()
File "C:\Users\Admin\Desktop\ragwithurb\7urb.py", line 163, in main
ingested_data = data_ingestion()
^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 168, in wrapper
return cached_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 197, in call
return self._get_or_create_cached_value(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 224, in _get_or_create_cached_value
return self._handle_cache_miss(cache, value_key, func_args, func_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 280, in _handle_cache_miss
computed_value = self._info.func(*func_args, **func_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\Desktop\ragwithurb\7urb.py", line 71, in data_ingestion
db = Chroma.from_documents(texts, embeddings, persist_directory=persist_directory, client_settings=CHROMA_SETTINGS)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain_community\vectorstores\chroma.py", line 778, in from_documents
return cls.from_texts(
^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain_community\vectorstores\chroma.py", line 714, in from_texts
chroma_collection = cls(
^^^^
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain_community\vectorstores\chroma.py", line 120, in init
self._client = chromadb.Client(client_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\chromadb_init
.py", line 274, in Client
return ClientCreator(tenant=tenant, database=database, settings=settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\chromadb\api\client.py", line 139, in init
super().init(settings=settings)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\chromadb\api\client.py", line 42, in init
self._identifier = SharedSystemClient._get_identifier_from_settings(settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\AppData\Local\Programs\Python\Python311\Lib\site-packages\chromadb\api\client.py", line 71, in _get_identifier_from_settings
api_impl = settings.chroma_api_impl
^^^^^^^^^^^^^^^^^^^^^^^^

Spanish response

Hi,

The Python app runs perfectly, but when I upload a PDF in Spanish and ask questions in Spanish, I receive responses in English.

It always says, 'The context does not provide an answer to the question "Contesta en el idioma que te escriban how are you?".'

How can this be resolved?

Thanks very much

changes

Your chroma settings needs to be updated so that it runs in line with the changes made to chromadb

Error: type Document is not JSON serializable

MarshallComponentException: ('Could not convert component args to JSON', TypeError('Object of type Document is not JSON serializable'))

Traceback:

file "C:..\chatbot.py", line 97, in
main()
File "C:..I\chatbot.py", line 93, in main
display_conversation(st.session_state)
File "C:..\chatbot.py", line 65, in display_conversation
message(history["generated"][i],key=str(i))
File "C:\Users...conda\envs\myenv\lib\site-packages\streamlit_chat_init_.py", line 104, in message
_streamlit_chat(message=message, seed=seed, isUser=is_user, avatarStyle=avatar_style, key=key, allow_html=allow_html, is_table=is_table)

TypeError: root_validator() takes 0 positional arguments but 1 was given

After downgrading from pydantic v2, pydantic settings v2 to v1 its giving below error. Appreciate if you help to resolve the issue.

2023-12-04 15:52:19.982 Uncaught app exception
Traceback (most recent call last):
File "/Users/genai/anaconda3/envs/langchain/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script
exec(code, module.dict)
File "/Users/genai//Study/langchain/chatbot_app.py", line 10, in
from langchain.document_loaders import PyPDFLoader, DirectoryLoader, PDFMinerLoader
File "/Users/genai//anaconda3/envs/langchain/lib/python3.10/site-packages/langchain/init.py", line 6, in
from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain
File "/Users/genai//anaconda3/envs/langchain/lib/python3.10/site-packages/langchain/agents/init.py", line 31, in
from langchain.agents.agent import (
File "/Users/genai//anaconda3/envs/langchain/lib/python3.10/site-packages/langchain/agents/agent.py", line 14, in
from langchain.agents.agent_iterator import AgentExecutorIterator
File "/Users/genai//anaconda3/envs/langchain/lib/python3.10/site-packages/langchain/agents/agent_iterator.py", line 21, in
from langchain.callbacks.manager import (
File "/Users/genai//anaconda3/envs/langchain/lib/python3.10/site-packages/langchain/callbacks/init.py", line 10, in
from langchain.callbacks.aim_callback import AimCallbackHandler
File "/Users/genai//anaconda3/envs/langchain/lib/python3.10/site-packages/langchain/callbacks/aim_callback.py", line 5, in
from langchain.schema import AgentAction, AgentFinish, LLMResult
File "/Users/genai//anaconda3/envs/langchain/lib/python3.10/site-packages/langchain/schema/init.py", line 19, in
from langchain.schema.output import (
File "/Users/genai//anaconda3/envs/langchain/lib/python3.10/site-packages/langchain/schema/output.py", line 50, in
class ChatGeneration(Generation):
File "/Users/genai//anaconda3/envs/langchain/lib/python3.10/site-packages/langchain/schema/output.py", line 59, in ChatGeneration
def set_text(cls, values: Dict[str, Any]) -> Dict[str, Any]:
TypeError: root_validator() takes 0 positional arguments but 1 was given

AttributeError: __pydantic_private__

After running the file streamlit run chatbot_app.py, I am getting the below error.
All the libraries are installed properly.
What could be the reason?

AttributeError: pydantic_private
Traceback:
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\streamlit\runtime\scriptrunner\script_runner.py", line 535, in _run_script
exec(code, module.dict)
File "C:\GithubRepository\Chat-with-PDF-Chatbot\chatbot_app.py", line 172, in
main()
File "C:\GithubRepository\Chat-with-PDF-Chatbot\chatbot_app.py", line 140, in main
ingested_data = data_ingestion()
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 212, in wrapper
return cached_func(*args, **kwargs)
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 241, in call
return self._get_or_create_cached_value(args, kwargs)
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 268, in _get_or_create_cached_value
return self._handle_cache_miss(cache, value_key, func_args, func_kwargs)
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\streamlit\runtime\caching\cache_utils.py", line 324, in _handle_cache_miss
computed_value = self._info.func(*func_args, **func_kwargs)
File "C:\GithubRepository\Chat-with-PDF-Chatbot\chatbot_app.py", line 47, in data_ingestion
db = Chroma.from_documents(texts, embeddings, persist_directory=persist_directory, client_settings=CHROMA_SETTINGS)
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\langchain\vectorstores\chroma.py", line 613, in from_documents
return cls.from_texts(
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\langchain\vectorstores\chroma.py", line 568, in from_texts
chroma_collection = cls(
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\langchain\vectorstores\chroma.py", line 126, in init
self._collection = self._client.get_or_create_collection(
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\chromadb\api\local.py", line 141, in get_or_create_collection
return self.create_collection(
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\chromadb\api\local.py", line 111, in create_collection
return Collection(
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\chromadb\api\models\Collection.py", line 52, in init
self._client = client
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\pydantic\main.py", line 776, in setattr
if self.pydantic_private is None or name not in self.private_attributes:
File "C:\GithubRepository\Chat-with-PDF-Chatbot.venv\lib\site-packages\pydantic\main.py", line 764, in getattr
return super().getattribute(item) # Raises AttributeError if appropriate

raise ValueError(LEGACY_ERROR) ValueError: You are using a deprecated configuration of Chroma.

Getting error:
raise ValueError(LEGACY_ERROR) ValueError: You are using a deprecated configuration of Chroma.
while runnig ingest.py

These are the versions i have installed:

streamlit==1.24.0
langchain==0.0.354
transformers==4.36.2
torch==2.1.2
einops==0.6.1
bitsandbytes==0.41.1
accelerate==0.21.0
pdfminer.six==20221105
bs4==0.0.1
sentence_transformers
duckdb==0.7.1
chromadb==0.4.22
beautifulsoup4==4.12.2
sentence-transformers==2.2.2
sentencepiece==0.1.99
six==1.16.0
requests==2.31.0
uvicorn==0.25.0
torchvision==0.16.2
streamlit-chat==0.1.1
pypdf

And Then found one solution to slove the above error by Downgrading chromadb version to 0.3.29
Here again facing some error:

Building wheel for hnswlib (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for hnswlib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [5 lines of output]
running bdist_wheel
running build
running build_ext
building 'hnswlib' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for hnswlib
Failed to build hnswlib
ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects

CAN ANYONE HELP ME TO SOLVE THE ERROR

pydantic error

%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\bitsandbytes\cextension.py:34: UserWarning: The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers, 8-bit multiplication, and GPU quantization are unavailable.
warn("The installed version of bitsandbytes was compiled without GPU support. "
'NoneType' object has no attribute 'cadam32bit_grad_fp32'
Creating embeddings. May take some minutes...
Traceback (most recent call last):
File "D:\chatpdf\Chat-with-PDF-Chatbot\ingest.py", line 32, in
main()
File "D:\chatpdf\Chat-with-PDF-Chatbot\ingest.py", line 25, in main
db = Chroma.from_documents(texts, embeddings, persist_directory=persist_directory, client_settings=CHROMA_SETTINGS)
File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\vectorstores\chroma.py", line 613, in from_documents
return cls.from_texts(
File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\vectorstores\chroma.py", line 568, in from_texts
chroma_collection = cls(
File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\vectorstores\chroma.py", line 126, in init
self._collection = self._client.get_or_create_collection(
File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\chromadb\api\local.py", line 141, in get_or_create_collection
return self.create_collection(
File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\chromadb\api\local.py", line 111, in create_collection
return Collection(
File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\chromadb\api\models\Collection.py", line 52, in init
self._client = client
File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\pydantic\main.py", line 768, in setattr
if self.pydantic_private is None or name not in self.private_attributes:
File "%USERPROFILE%\AppData\Local\Programs\Python\Python310\lib\site-packages\pydantic\main.py", line 756, in getattr
return super().getattribute(item) # Raises AttributeError if appropriate
AttributeError: 'Collection' object has no attribute 'pydantic_private'. Did you mean: 'pydantic_complete'?

PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.2/migration/#basesettings-has-moved-to-pydantic-settings for more details.

import os 
import chromadb
from chromadb.config import Settings 
CHROMA_SETTINGS = Settings(
        chroma_db_impl='duckdb+parquet',
        persist_directory='db',
        anonymized_telemetry=False
)

gives error:

---------------------------------------------------------------------------
PydanticImportError                       Traceback (most recent call last)
[<ipython-input-24-ba6cc87c8bff>](https://localhost:8080/#) in <cell line: 2>()
      1 import os
----> 2 import chromadb
      3 from chromadb.config import Settings
      4 CHROMA_SETTINGS = Settings(
      5         chroma_db_impl='duckdb+parquet',

3 frames
[/usr/local/lib/python3.10/dist-packages/pydantic/_migration.py](https://localhost:8080/#) in wrapper(name)
    287             return import_string(REDIRECT_TO_V1[import_path])
    288         if import_path == 'pydantic:BaseSettings':
--> 289             raise PydanticImportError(
    290                 '`BaseSettings` has been moved to the `pydantic-settings` package. '
    291                 f'See [https://docs.pydantic.dev/{version_short()}/migration/#basesettings-has-moved-to-pydantic-settings](https://docs.pydantic.dev/%7Bversion_short()%7D/migration/#basesettings-has-moved-to-pydantic-settings) '

PydanticImportError: `BaseSettings` has been moved to the `pydantic-settings` package. See https://docs.pydantic.dev/2.2/migration/#basesettings-has-moved-to-pydantic-settings for more details.

For further information visit https://errors.pydantic.dev/2.2/u/import-error

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

Error

Screenshot_2023-08-21-18-45-33-172
I have deployed this repo in render.com

This error came when I opened the link

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.