Skip to content
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

Gemini #1520

Merged
merged 11 commits into from
Dec 15, 2023
Merged

Gemini #1520

merged 11 commits into from
Dec 15, 2023

Conversation

jeffchuber
Copy link
Contributor

@jeffchuber jeffchuber commented Dec 14, 2023

This adds a Google Gemini embedding function and an RAG chat example

TODO

  • JS support
  • Docs PR

Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readbility, Modularity, Intuitiveness)

@@ -0,0 +1,3 @@
chromadb>=0.4.4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this more restrictive?

self._genai.embed_content(
model=self._model_name,
content=text,
task_type="retrieval_document",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make this configurable?

model=self._model_name,
content=text,
task_type="retrieval_document",
title="Embedding of single string",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this?

class GoogleGenerativeAiEmbeddingFunction(EmbeddingFunction[Documents]):
"""To use this EmbeddingFunction, you must have the google.generativeai Python package installed and have a Google API key."""

"""Use RETRIEVAL_DOCUMENT for the task_type for embedding, and RETRIEVAL_QUERY for the task_type for retrieval."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice


var app = express();
app.get("/", async (req, res) => {
const cc = new chroma.ChromaClient({ path: "http://localhost:8000" });
await cc.reset();

const openAIembedder = new chroma.OpenAIEmbeddingFunction("key")
const cohereAIEmbedder = new chroma.OpenAIEmbeddingFunction({ openai_api_key: "API_KEY" });
console.log("entry")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove?

@jeffchuber jeffchuber merged commit 99c0e9f into main Dec 15, 2023
95 checks passed
@jeffchuber jeffchuber deleted the gemini branch December 15, 2023 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants