rag_api icon indicating copy to clipboard operation
rag_api copied to clipboard

Added Google GenAI Embeddings

Open yihyang opened this issue 9 months ago • 1 comments

Added Google GenAI Embeddings

  • Langchain Google GenAI Embeddings doc: https://python.langchain.com/api_reference/google_genai/embeddings/langchain_google_genai.embeddings.GoogleGenerativeAIEmbeddings.html#langchain_google_genai.embeddings.GoogleGenerativeAIEmbeddings

yihyang avatar Mar 02 '25 05:03 yihyang

the new gemini-embedding-exp-03-07 over Gemini API would be nice too https://ai.google.dev/gemini-api/docs/models#gemini-embedding

Dual-0 avatar May 04 '25 00:05 Dual-0

This will only work with an API key and not via Vertex API, correct? Would be really nice to have this for Vertex as well.

falkenbt avatar May 28 '25 09:05 falkenbt

@Dual-0 setting the environment variable EMBEDDINGS_MODEL to models/gemini-embedding-exp-03-07 will allow it to use gemini-embedding-exp-03-07 model

yihyang avatar May 28 '25 10:05 yihyang

@falkenbt yes this works with Google GenAI, I can add VertexAI support in Subsequent PRs

yihyang avatar May 28 '25 10:05 yihyang

@falkenbt I've implemented VertexAI support in this PR: https://github.com/danny-avila/rag_api/pull/154

yihyang avatar May 28 '25 10:05 yihyang

wow that was fast, thank you!

falkenbt avatar May 30 '25 15:05 falkenbt

@Dual-0 setting the environment variable EMBEDDINGS_MODEL to models/gemini-embedding-exp-03-07 will allow it to use gemini-embedding-exp-03-07 model

with EMBEDDINGS_PROVIDER=google or and EMBEDDINGS_MODEL=models/gemini-embedding-exp-03-07:

  File "/app/app/config.py", line 234, in <module>
    EMBEDDINGS_PROVIDER = EmbeddingsProvider(
  File "/usr/local/lib/python3.10/enum.py", line 385, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.10/enum.py", line 710, in __new__
    raise ve_exc
ValueError: 'google' is not a valid EmbeddingsProvider

or google_genai

...
ValueError: 'google_genai' is not a valid EmbeddingsProvider

only with EMBEDDINGS_MODEL=models/gemini-embedding-exp-03-07:

openai.BadRequestError: Error code: 400 - {'error': {'message': 'invalid model ID', 'type': 'invalid_request_error', 'param': None, 'code': None}}

I will wait for merge...

Dual-0 avatar Jun 04 '25 23:06 Dual-0

Thank you for the PR, please address merge conflicts.

danny-avila avatar Jun 11 '25 12:06 danny-avila

@danny-avila thanks for merging the previous PR, I've resolved the conflict here: https://github.com/danny-avila/rag_api/pull/124/commits/c2ca2828205e4e59a3c5bcbe65412638a505d420

yihyang avatar Jun 11 '25 13:06 yihyang

having this merged would be the only reason to use LibreChat for me right now :) can it be merged @danny-avila ?

alexferrari88 avatar Jul 04 '25 02:07 alexferrari88

I resolved conflicts, bumped packages here: https://github.com/danny-avila/rag_api/pull/202

Thanks for your work on this

danny-avila avatar Aug 27 '25 19:08 danny-avila