private-gpt icon indicating copy to clipboard operation
private-gpt copied to clipboard

Privategpt displays an error when you ask a question before uploading a document

Open devintrowbridge opened this issue 2 years ago • 14 comments

Problem

After initial setting up privategpt, I have an issue where i get a Exception: Collection make_this_parameterizable_per_api_call not found on any input. This appears in the web interface as well as the web ui.

Cause

The cause of this is not having any documents loaded before asking a question.

Proposed Solution

Instead of return an error, privategpt should return some hint or useful feedback to correct the issue.

devintrowbridge avatar Nov 28 '23 22:11 devintrowbridge

Hey there Devin! I am currently experiencing the same problem. I've narrowed it down to the /private_gpt/components/vector_store/vector_store_component.py file. In the file, the names of the qdrant and chroma databases are not declared. I will put the relevant code down below (note the commented out "TODO" sections), if anyone has a solution to this, I would be greatly appreciative!:

@singleton
class VectorStoreComponent:
    vector_store: VectorStore

    @inject
    def __init__(self, settings: Settings) -> None:
        match settings.vectorstore.database:
            case "chroma":
                try:
                    import chromadb  # type: ignore
                    from chromadb.config import (  # type: ignore
                        Settings as ChromaSettings,
                    )
                except ImportError as e:
                    raise ImportError(
                        "'chromadb' is not installed."
                        "To use PrivateGPT with Chroma, install the 'chroma' extra."
                        "`poetry install --extras chroma`"
                    ) from e

                chroma_settings = ChromaSettings(anonymized_telemetry=False)
                chroma_client = chromadb.PersistentClient(
                    path=str((local_data_path / "chroma_db").absolute()),
                    settings=chroma_settings,
                )
                chroma_collection = chroma_client.get_or_create_collection(
                    "make_this_parameterizable_per_api_call"
                )  # TODO

                self.vector_store = typing.cast(
                    VectorStore,
                    BatchedChromaVectorStore(
                        chroma_client=chroma_client, chroma_collection=chroma_collection
                    ),
                )

            case "qdrant":
                from llama_index.vector_stores.qdrant import QdrantVectorStore
                from qdrant_client import QdrantClient

                if settings.qdrant is None:
                    logger.info(
                        "Qdrant config not found. Using default settings."
                        "Trying to connect to Qdrant at localhost:6333."
                    )
                    client = QdrantClient()
                else:
                    client = QdrantClient(
                        **settings.qdrant.model_dump(exclude_none=True)
                    )
                self.vector_store = typing.cast(
                    VectorStore,
                    QdrantVectorStore(
                        client=client,
                        collection_name="make_this_parameterizable_per_api_call",
                    ),  # TODO
                )
            case _:
                # Should be unreachable
                # The settings validator should have caught this
                raise ValueError(
                    f"Vectorstore database {settings.vectorstore.database} not supported"`

apexEvan avatar Nov 29 '23 14:11 apexEvan

Problem

After initial setting up privategpt, I have an issue where i get a Exception: Collection make_this_parameterizable_per_api_call not found on any input. This appears in the web interface as well as the web ui.

Cause

The cause of this is not having any documents loaded before asking a question.

Proposed Solution

Instead of return an error, privategpt should return some hint or useful feedback to correct the issue.

Fully agree! Would you open a PR with a better handling of that error? It'd be a great contribution!

imartinez avatar Nov 29 '23 19:11 imartinez

Im gettting this same error. have there been any updates on this?

SamPink avatar Dec 06 '23 09:12 SamPink

this happens when you try to load your old chroma db with the new 0.1.0 version of privategpt, because the default vectorstore changed to qdrant. go to settings.yaml and change vectorstore: database: qdrant to vectorstore: database: chroma and it should work again. https://docs.privategpt.dev/manual/storage/vector-stores#chroma-configuration

Kosmoshn avatar Dec 09 '23 00:12 Kosmoshn

this happens when you try to load your old chroma db with the new 0.1.0 version of privategpt, because the default vectorstore changed to qdrant. go to settings.yaml and change vectorstore: database: qdrant to vectorstore: database: chroma and it should work again. https://docs.privategpt.dev/manual/storage/vector-stores#chroma-configuration

This solution worked for me. Thank you.

tyrell avatar Dec 14 '23 23:12 tyrell

I had this error on version 0.2.0 I simply didn't check I had installed the commands for the Quick Start . I particularly found poetry needed to be install with : curl -sSL https://install.python-poetry.org | python3 - Just in case your like me don't forget to install these too, I took it all for granted. sudo apt install git python3.11 python3.11-venv

StarMariner avatar Dec 15 '23 20:12 StarMariner

@Kosmoshn thanks for the note and I hope that the documentation for Windows can reflect that (also poetry install --extras chroma)

TomLucidor avatar Dec 25 '23 08:12 TomLucidor

this happens when you try to load your old chroma db with the new 0.1.0 version of privategpt, because the default vectorstore changed to qdrant. go to settings.yaml and change vectorstore: database: qdrant to vectorstore: database: chroma and it should work again. https://docs.privategpt.dev/manual/storage/vector-stores#chroma-configuration

Unfortunately this didn't work for me.

What about this paramater in the settings.yaml? Should'nt this be changed to chroma path?

qdrant: path: local_data/private_gpt/qdrant

needlzzz avatar Mar 17 '24 09:03 needlzzz

Anyone finally got through this issue ?

levydanqc avatar Mar 20 '24 03:03 levydanqc

Following up on this. Any workaround?

qwet11 avatar Mar 21 '24 22:03 qwet11

+1 on this issue. I deleted the local_data and switched to chroma db. It started working. But the issue with qdrant needs to be fixed.

satheshshiva avatar Mar 23 '24 07:03 satheshshiva

+1 on this issue. I deleted the local_data and switched to chroma db. It started working. But the issue with qdrant needs to be fixed.

How did you do that

blkryd avatar Apr 03 '24 08:04 blkryd

Make sure that you have selected the "LLM Chat (no context from files)" option. I had the same error and it narrowed down to selecting the toggle while asking questions before uploading files smh

Screenshot 2024-04-04 170522

chrisdabre avatar Apr 05 '24 00:04 chrisdabre

I made changes to the settings.yaml file to update the database configuration from qdrant to chroma. After making these changes, everything worked as expected.

vectorstore: 
  database: qdrant

qdrant: 
  path: local_data/private_gpt/qdrant 

to

vectorstore: 
  database: chroma

chroma: 
  path: local_data/private_gpt/chroma

sujanshresstha avatar May 27 '24 07:05 sujanshresstha