SPEZILLM - Using Gemini with the OPENAI or writing own module #90
-
What Stanford Spezi module is your challenge related to?Other module DescriptionI am looking at the possibilities of integrating the Gemini API, mostly due to cost and their multimodal capabilities. Reproductiondiscussion Expected behaviordiscussion Additional contextNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
@philippzagar Would be able to provide some more context on this. |
Beta Was this translation helpful? Give feedback.
-
Hi @JJjulle, Thank you for reaching out and for exploring SpeziLLM! We’re excited to hear it’s being considered for your application 🚀 There are two main approaches to integrating the Gemini API with SpeziLLM, depending on the level of integration you’re aiming for: 1. Leverage Gemini’s OpenAI Compatibility Layer (Minimal Changes)As you mentioned, Gemini offers compatibility with the OpenAI API specification. This allows for a relatively straightforward integration: You can slightly modify the SpeziLLMOpenAI target to support a configurable API endpoint when initializing either 2. Build a Native Gemini Integration (Larger Changes)Alternatively, you can develop a native Gemini integration within SpeziLLM by creating a new target, for example
You can use the existing SpeziLLMOpenAI implementation as a reference for structuring your implementation of the SpeziLLM protocols. Keep in mind that this path involves more significant development effort and will be more time-consuming. Multimodal Input Support (Image, Video, Audio)Currently, SpeziLLM is primarily built around text-based interactions using chat-style models, as defined in SpeziChat’s ChatEntity. Support for multimodal input (images, video, audio) is not yet available but is part of our future roadmap. However, this will require substantial architectural changes and will take time to fully support. Feel free to let us know which direction you’d like to pursue or if you need any further guidance on using or extending SpeziLLM. We’re happy to assist. |
Beta Was this translation helpful? Give feedback.
Hi @JJjulle,
Thank you for reaching out and for exploring SpeziLLM! We’re excited to hear it’s being considered for your application 🚀
There are two main approaches to integrating the Gemini API with SpeziLLM, depending on the level of integration you’re aiming for:
1. Leverage Gemini’s OpenAI Compatibility Layer (Minimal Changes)
As you mentioned, Gemini offers compatibility with the OpenAI API specification. This allows for a relatively straightforward integration:
You can slightly modify the SpeziLLMOpenAI target to support a configurable API endpoint when initializing either
LLMOpenAIPlatform
orLLMOpenAISchema
. By pointing to Gemini’s OpenAI-compatible endpoint:https://generativelan…