-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update cohere client to V2 #417
Conversation
I keep API keys in environment variables in a .env file. If I ran `just test-server` from my dev host, the command in build.py was explicitly setting the environment vars in the docker exec command without reading the .env file yielding empty environment vars. build.py does not load a .env file because we don't want build.py to depend on any 3rd party dependencies (just std lib). This change fixes the issue. The test server will load the .env file. No need to set env vars explicitly in the `docker exec` call.
d911f2c
to
9962a69
Compare
response = client.embed(texts=[input_text], model=model, embedding_types=["float"], **args) | ||
return response.embeddings.float[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any use case to exposing the embedding types to the end user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe? I did a brief look to see if any alternate embedding type from cohere would map to an alternate vector type from pgvector, but it wasn't obvious that any did.
-e VOYAGE_API_KEY=${VOYAGE_API_KEY} \ | ||
-it -w /pgai/tests/vectorizer pgai-ext fastapi dev server.py | ||
""" | ||
cmd = """docker exec -it -w /pgai/tests/vectorizer pgai-ext uv run fastapi dev server.py""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove the env-var passing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explained in the commit message. The test server looks up these env cars in a .env file, but for some reason putting these explicitly on the docker exec command was causing them to be empty. It took precedence over the dot env file
Updates cohere client to 5.13.11 which adds support for the V2 endpoints for embed, chat, and rerank. This introduces breaking changes to the corresponding pgai functions, but unlocks the latest features from cohere.
This PR also adds support for Cohere to text-to-sql. This is feature-flagged, non-production code.