BerriAI / litellm

Call all LLM APIs using the OpenAI format. Use Bedrock, Azure, OpenAI, Cohere, Anthropic, Ollama, Sagemaker, HuggingFace, Replicate (100+ LLMs)
https://docs.litellm.ai/docs/
Other
10.54k stars 1.19k forks source link

how to use vertex gemini with Proxy? #1232

Closed tgyy1995 closed 6 months ago

krrishdholakia commented 6 months ago

Hey @tgyy1995, do you have vertex ai credentials stored in your server?

krrishdholakia commented 6 months ago

you'll need to store your credentials like this

Screenshot 2023-12-23 at 5 44 41 PM
tgyy1995 commented 6 months ago

I can use Gemini in this way:

from litellm import completion
import os
# auth: run 'gcloud auth application-default'
os.environ["VERTEX_PROJECT"] = "hardy-device-386718"
os.environ["VERTEX_LOCATION"] = "us-central1"
response = completion(
  model="chat-bison", 
  messages=[{ "content": "Hello, how are you?","role": "user"}]
)

But I want to use Gemini in this way and i dont kown how. For example, litellm --model huggingface/bigcode/starcoder. How should I set up VERTEX_PROJECT and VERTEX_LOCATION?

krrishdholakia commented 6 months ago

Do this in your terminal before running the liteLLM command.

export VERTEX_PROJECT="hardy-project"
export VERTEX_LOCATION="us-west"
tgyy1995 commented 6 months ago

Thank you.

ishaan-jaff commented 6 months ago
Screenshot 2023-12-27 at 5 15 48 PM

@tgyy1995 added docs on how to do this too: https://docs.litellm.ai/docs/providers/vertex#gemini-pro

ishaan-jaff commented 6 months ago

@tgyy1995 what are you using the LiteLLM proxy for ?

tgyy1995 commented 6 months ago

Thank you for your work. I can now use Gemini. I use Litellm for autogen.