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

[Feature Request] Can we get access to text-multilingual-embedding models #254

Closed
Champkinz opened this issue May 27, 2024 · 4 comments
Closed
Labels
feature New feature or request

Comments

@Champkinz
Copy link

Is your feature request related to a problem? Please describe.
I have a requirement to embed non English text, but at the moment i can only access textEmbeddingGecko through,
import { textEmbeddingGecko, vertexAI } from '@genkit-ai/vertexai';

Describe the solution you'd like
A way to use a multilingual embedding model through genkit

Describe alternatives you've considered
Using the Vertex python SDK

I don't want mix too many SDKs, want to keep it concise so we can maintain our solution without a hassle.

@Champkinz Champkinz added the feature New feature or request label May 27, 2024
@Champkinz Champkinz changed the title [JS] Can we get access to text-multilingual-embedding models [Feature Request] Can we get access to text-multilingual-embedding models May 27, 2024
@Champkinz
Copy link
Author

Champkinz commented May 31, 2024

So i did some digging and found this comment

/*
// @TODO(huangjeff): Fix multilingual text embedding gecko
// For some reason this model returns 404 but it exists in the reference docs:
// https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings

export const textEmbeddingGeckoMultilingual001 = embedderRef({
  name: 'vertexai/textembedding-gecko-multilingual@001',
  configSchema: TextEmbeddingGeckoConfigSchema,
  info: {
    dimensions: 768,
    label: 'Vertex AI - Multilingual Text Embedding Gecko',
    supports: {
      input: ['text'],
    },
  },
});
*/

export const textEmbeddingGecko = textEmbeddingGecko003;

export const SUPPORTED_EMBEDDER_MODELS: Record<string, EmbedderReference> = {
  'textembedding-gecko@003': textEmbeddingGecko003,
  'textembedding-gecko@002': textEmbeddingGecko002,
  'textembedding-gecko@001': textEmbeddingGecko001,
  //'textembeddding-gecko-multilingual@001': textEmbeddingGeckoMultilingual001,
};

I'll be working on fixing this or try the defineEmbedder method

if successful, I can raise a PR for this.

@Champkinz
Copy link
Author

Champkinz commented May 31, 2024

I FIGURED IT OUT 🙌

The issue here is
//'textembeddding-gecko-multilingual@001': textEmbeddingGeckoMultilingual001,

has an extra 'd' in the model,

remove that extra d and it starts working, i have tested this locally and i can confirm its working

 const SUPPORTED_EMBEDDER_MODELS = {
  "textembedding-gecko@003": textEmbeddingGecko003,
  "textembedding-gecko@002": textEmbeddingGecko002,
  "textembedding-gecko@001": textEmbeddingGecko001,
  'textembedding-gecko-multilingual@001': textEmbeddingGeckoMultilingual001,
};

The 404 error is because the end point was calling with the wrong embedder name

https://<selected_region>-aiplatform.googleapis.com/v1/projects/<project_id>/locations/<selected_region>/publishers/google/models/textembeddding-gecko-multilingual@001:predict

instead of

https://<selected_region>-aiplatform.googleapis.com/v1/projects/<project_id>/locations/<selected_region>/publishers/google/models/textembedding-gecko-multilingual@001:predict

@pavan168
Copy link

pavan168 commented Jun 2, 2024

+1

@pavelgj pavelgj closed this as completed Jun 20, 2024
@pavelgj
Copy link
Collaborator

pavelgj commented Jun 20, 2024

These were added in #340 and released in 0.5.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants