new feature brainstorming - embedding API #42
jeremychone
started this conversation in
General
Replies: 2 comments 1 reply
-
might be best if we split adapter into two different traits: completion and embedding. not all providers provide embedding, so a good indicator of whether one does or not could be the traits it implements (CompletionAdapter, EmbeddingAdapter) |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hi, I'm a happy user of this crate and this feature would benefit me a lot. So here are my 2 cents: I have a couple of questions about some of the implementation details:
// Single
let embedding = client.embed("text-embedding-3-small", "Hello world").await?;
let vector: Vec<f32> = embedding.vector;
// Batch
let embeddings = client.embed_batch("text-embedding-3-small", vec!["text1", "text2"]).await?; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Following this comment #28 about embeddings, here is a proposal for what the API could look like, and this discussion is about refining it.
client.embed(model, content)
.Adapter
can be extended with thisembed(...)
method.genai
is not in the business (for now) of knowing which model does what, so if the model does not support the API, it will fail.src/embed
, probably from the root, that will have the return type, for example. The input can just be a string, but we might want to have an input struct.adapters/...
directory, we should have another file calledembed.rs
or something similar; this way, it's clear what we have.These are just some initial thoughts. My hope is that we can piggyback off the chat resolution/flow but have another API or object.
Let's start the discussion to refine or redefine these points. We can just have pros/cons for things we think we might want to take a different approach on, and the goal of this discussion is to get a good, simple code example that we can put in our examples/....
CC @GustavoWidman
Beta Was this translation helpful? Give feedback.
All reactions