CHROMA VECTOR-DATABASE - OSError: [Errno 22] Invalid argument: '\\'

103 views Asked by At

I'm currently working on loading pre-vectorized text data into a Chroma vector database with a .py. However, I've encountered an issue where I'm receiving a "OSError: [Errno 22] Invalid argument: '\ ' "

To provide some context, I'm working on a WINDOWS remote server, which has a path like \ \server_example_a2\ANALYTICAL_DEVELOPMENTS\DEMOLINAR\CHAT_BOT, an my function is like:

from langchain.vectorstores import Chroma #(one of the libraries)

def get_chroma_db(embeddings, documents, path):

    if recreate_chroma_db:
        console.print("RECREATING CHROMA DB")
        return Chroma.from_documents(
            documents=documents, embedding=embeddings, persist_directory=path
        )
    else:
        path ='\\server_example_a2\ANALYTICAL_DEVELOPMENTS\DEMOLINAR\CHAT_BOT\ai_c.py'
        console.print("LOADING CHROMA DB")
        return Chroma(persist_directory=path, embedding_function=embeddings)


vectorstore_chroma = get_chroma_db(embeddings, documents, "chroma_docs")


usually in developments from what I have seen they do not use: path ='\server_example_a2\ANALYTICAL_DEVELOPMENTS\DEMOLINAR\CHAT_BOT\ai_c.py', however with or without the path the code does not work on the server

I tried to define the path and not define it, reflect double \ \ and simple \

0

There are 0 answers