Openai.API error : 500 when using with Chromadb on Windows Server 2012, but not Windows 11

I keep getting this error:

500 {‘error’: {‘message’: 'The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error.

when running a python script on a Windows Server 2012 VM, but the exact same script runs fine on Windows 11.

Here’s a snippet of the function:

     loader = DirectoryLoader(directory_path, glob='**/*.txt')
    documents = loader.load()
    text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
    texts = text_splitter.split_documents(documents)
    embeddings = OpenAIEmbeddings()
    prompt_template = """
    Answer the question below starting with: "Here is my suggestion:".

    {context}

    Question: {question}
    Answer:
    """

    PROMPT = PromptTemplate(
        template=prompt_template, input_variables=["context", "question"]
    )
    chain_type_kwargs = {"prompt": PROMPT}

    db = Chroma.from_documents(texts, embeddings)
    retriever = db.as_retriever(search_type="similarity", search_kwargs={"k":2})
    qa = RetrievalQA.from_chain_type(
    llm=OpenAI(), chain_type="stuff", retriever=retriever, return_source_documents=True, chain_type_kwargs=chain_type_kwargs)
    return qa

The code specifically seems to stop right at:

db = Chroma.from_documents(texts, embeddings)

Any assistance would be greatly appreciated.

Thanks

Is the VM your own machine or is it part of a VPS? What version of the chroma libraries do you have on each install? Have you been to the chroma Discord and enquired there?

Python version? Python org decided to be dumb and intractable, and Python 3.9+ is only supported on Windows 10+.

Server 2012 is the equivalent of Windows 8.

I use non-official builds of 3.8.16, installed as administrator for all users. You must also then do any “pip install” with an administrator cmd or powershell. Other libraries also get dicey with windows 7, like pyside6, latest version I could get working was PySide6-6.1.3-6.1.3-cp36.cp37.cp38.cp39-none-win_amd64.whl manually installed by pip.

chroma-core requirements.txt:

clickhouse-connect==0.5.7

duckdb==0.7.1

fastapi==0.85.1

graphlib_backport==1.0.3; python_version < ‘3.9’

hnswlib==0.7.0

numpy==1.21.6

onnxruntime==1.14.1

overrides==7.3.1

pandas==1.3.5

posthog==2.4.0

pulsar-client==3.1.0

pydantic==1.9.0

pypika==0.48.9

requests==2.28.1

tokenizers==0.13.2

tqdm==4.65.0

typing_extensions==4.5.0

uvicorn[standard]==0.18.3

The machine is part of a VPS
Both machines are using chromadb 0.3.11
I wanted to keep the libraries the same.

I’ve just joined the Discord to ask there as well, thanks for the tip.

I’m using 3.11.4
Perhaps I should downgrade?

See above. It’s really annoying to see any “3.9+ required” modules because of this. Unlike XP or POSReady VMs, you can’t run Windows 11 in 256MB memory…

Well, I downgraded to the version you are using in your post. as well as installed the libraries as per the post.
I’m unfortunately still getting the 500 error.

openai.error.APIError: The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error. {
  "error": {
    "message": "The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error. ",
    "type": "server_error",
    "param": null,
    "code": null
  }
}

Dump the request message steps to the shell with a print statement and see if you are generating identical strings for identical inputs. Also capture functions that rely on outside services or proper platform with try/except blocks and see if error returned has some information.

The fault is likely in providing invalid input to the API by earlier failure that should have been handled.

You might have to dig deeper into the module itself, and see where it might be relying on sys or os or character encodings specific to the OS, or contact the developer.

1 Like

After going through everything. As it turns out, Windows 2012 did not like running a large txt file that I had through chromaDB (one file was 3mb, the rest were under 250kb). I’m hoping I can convince our staff to upgrade from 2012 to a newer version.

Thanks again for all your help.

The fault is likely in providing invalid input to the API by earlier failure that should have been handled.

This was exactly the error, so thanks again for your help and patience.