Comments (7)
Nice! I was trying to get this working but had failed. Where are you setting these? Is ultra even a thing still, I thought they renamed it to advanced, but maybe the model name stayed the same. Are you in the beta program?
from gemini-ai.
I work for Google. I found also embeddings work:
# Take @gbaptista code in README and change this:
client = Gemini.new(
credentials: {
service: 'vertex-ai-api',
file_path: 'riccardo.json' ,
region: 'us-central1',
},
options: {
model: 'text-embedding-preview-0409',
service_version: 'v1',
}
)
result = client.request(
'predict',
{"instances": [
{ "content": 'Ford Prefect vs Zaphod'}
]}
)
I got the model name from these docs: https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings
from gemini-ai.
Ouch! So changing to vertex-ai-api, though it uses the same models, wasn't free and now I have a $120 bill lol. Google's having two very similar AI APis, with one being free, is super frustrating.
Any idea how to see which embeddings are available in generative-language-api? I can't figure out how to get it to list them, and the old 'embedding-001' is the only one I can find a reference to online. The new ones in vertex-ai-api like text-embedding-preview-0409 aren't there.
Kinda wish I'd found this before, but https://ollama.com/ is pretty amazing for running one of the free models locally.
from gemini-ai.
Brilliant list, thanks! How'd you get the list of models/embeddings to test?
I've been using text-embedding-preview-0409 since (was, still quite high) at the top of the MTEB https://huggingface.co/spaces/mteb/leaderboard
Ollama - oh nice, I hadn't noticed you were behind both, thanks for the great projects!
from gemini-ai.
Unfortunately, there's no API to list models in Vertex AI API to my knowledge.
With Generative Language API, this endpoint works for me:
https://generativelanguage.googleapis.com/v1/models?key=YOUR_KEY
In the gem, you can use it like this:
client = Gemini.new(
credentials: {
service: 'generative-language-api',
api_key: ENV.fetch('GOOGLE_API_KEY', nil)
},
options: { model: 'text-embedding-004', server_sent_events: true }
)
models = client.models
{ 'models' =>
[{ 'name' => 'models/gemini-1.0-pro',
'version' => '001',
'displayName' => 'Gemini 1.0 Pro',
'description' => 'The best model for scaling across a wide range of tasks',
'inputTokenLimit' => 30_720,
'outputTokenLimit' => 2048,
'supportedGenerationMethods' => %w[generateContent countTokens],
'temperature' => 0.9,
'topP' => 1 },
{ 'name' => 'models/gemini-1.0-pro-001',
'version' => '001',
'displayName' => 'Gemini 1.0 Pro 001 (Tuning)',
'description' => 'The best model for scaling across a wide range of tasks. This is a stable model that supports tuning.',
'inputTokenLimit' => 30_720,
'outputTokenLimit' => 2048,
'supportedGenerationMethods' => %w[generateContent countTokens createTunedModel],
'temperature' => 0.9,
'topP' => 1 }] }
The others I manually extracted from reading these pages:
from gemini-ai.
See scripts using your gem here: https://github.com/palladius/genai-googlecloud-scripts/tree/main/09-langchainrb-playground
from gemini-ai.
@inspire22 Ouch, sorry to hear that! Yeah, Ollama is great; I support a gem for using it: ollama-ai
About embeddings: I added new methods for embedding in version 4.0.0 of the gem.
I tested, and I can get embedding working with the model text-embedding-004
, both in Generative Language API:
result = client.embed_content(
{ content: { parts: [{ text: 'What is life?' }] } }
)
Or Vertex AI API:
result = client.predict(
{ instances: [{ content: 'What is life?' }],
parameters: { autoTruncate: true } }
)
@palladius It was great to meet you! Thanks for reaching out. I generated a script to test which model I have access to. Here's my result:
Model | Vertex AI | Generative Language |
---|---|---|
gemini-pro-vision | ✅ | 🔒 |
gemini-pro | ✅ | ✅ |
gemini-1.5-pro-preview-0514 | ✅ | 🔒 |
gemini-1.5-pro-preview-0409 | ✅ | 🔒 |
gemini-1.5-pro | 🔒 | 🔒 |
gemini-1.5-flash-preview-0514 | ✅ | 🔒 |
gemini-1.5-flash | 🔒 | 🔒 |
gemini-1.0-pro-vision-latest | 🔒 | 🔒 |
gemini-1.0-pro-vision-001 | ✅ | 🔒 |
gemini-1.0-pro-vision | ✅ | 🔒 |
gemini-1.0-pro-latest | 🔒 | ✅ |
gemini-1.0-pro-002 | ✅ | 🔒 |
gemini-1.0-pro-001 | ✅ | ✅ |
gemini-1.0-pro | ✅ | ✅ |
gemini-ultra | 🔒 | 🔒 |
gemini-1.0-ultra | 🔒 | 🔒 |
gemini-1.0-ultra-001 | 🔒 | 🔒 |
text-embedding-preview-0514 | 🔒 | 🔒 |
text-embedding-preview-0409 | 🔒 | 🔒 |
text-embedding-004 | ✅ | ✅ |
embedding-001 | 🔒 | ✅ |
text-multilingual-embedding-002 | ✅ | 🔒 |
textembedding-gecko-multilingual@001 | ✅ | 🔒 |
textembedding-gecko-multilingual@latest | ✅ | 🔒 |
textembedding-gecko@001 | ✅ | 🔒 |
textembedding-gecko@002 | ✅ | 🔒 |
textembedding-gecko@003 | ✅ | 🔒 |
textembedding-gecko@latest | ✅ | 🔒 |
@inspire22 This may help you with "what model works with what API" ☝️
I will do some benchmarks with gemini-1.5-pro-preview-0514
and gemini-1.5-flash-preview-0514
. 😄
from gemini-ai.
Related Issues (8)
- support for Application default credentials HOT 2
- My api result is an array with the response broken up over multiple candidates HOT 5
- Streaming is not working HOT 10
- Ways to pass temperature or max tokens? HOT 3
- Using Safety Settings HOT 3
- Support for system instructions HOT 1
- support/docs for json mode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gemini-ai.