zylon-ai / private-gpt

Interact with your documents using the power of GPT, 100% privately, no data leaks
https://privategpt.dev
Apache License 2.0
54.19k stars 7.29k forks source link

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

Open devintrowbridge opened 11 months ago

devintrowbridge commented 11 months ago

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.

apexEvan commented 11 months ago

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"`
imartinez commented 11 months ago

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!

SamPink commented 11 months ago

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

Kosmoshn commented 11 months ago

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

tyrell commented 11 months ago

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.

StarMariner commented 11 months ago

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

TomLucidor commented 10 months ago

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

needlzzz commented 8 months ago

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

levydanqc commented 8 months ago

Anyone finally got through this issue ?

qwet11 commented 8 months ago

Following up on this. Any workaround?

satheshshiva commented 7 months ago

+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.

blkryd commented 7 months ago

+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

chrisdabre commented 7 months ago

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

sujanshresstha commented 5 months ago

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