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

[Bug]: Getting error while trying to use gemini model for evaluation. #886

Open
1 of 4 tasks
sverma29-nexturn opened this issue Dec 13, 2024 · 1 comment
Open
1 of 4 tasks
Labels
bug Something isn't working

Comments

@sverma29-nexturn
Copy link

sverma29-nexturn commented Dec 13, 2024

What component(s) are affected?

  • Python SDK
  • Opik UI
  • Opik Server
  • Documentation

Opik version

  • Opik version: 1.2.6

Describe the problem

Getting the following error:


AuthenticationError: litellm.AuthenticationError: geminiException - {
  "error": {
    "code": 400,
    "message": "API key not valid. Please pass a valid API key.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "API_KEY_INVALID",
        "domain": "googleapis.com",
        "metadata": {
          "service": "generativelanguage.googleapis.com"
        }
      },
      {
        "@type": "type.googleapis.com/google.rpc.LocalizedMessage",
        "locale": "en-US",
        "message": "API key not valid. Please pass a valid API key."
      }
    ]
  }
}

Reproduction steps

import google.generativeai as genai
import litellm
import os
from litellm.integrations.opik.opik import OpikLogger
from opik import track
from opik.opik_context import get_current_span_data

GEMINI_API_KEY = "<API KEY>"
genai.configure(api_key=GEMINI_API_KEY)

model = genai.GenerativeModel("gemini-1.5-flash")

os.environ["OPIK_PROJECT_NAME"] = "gemini-integration-demo"
opik_logger = OpikLogger()
litellm.callbacks = [opik_logger]

prompt = """
Write a short two sentence story about Opik.
"""

response = litellm.completion(
    model="gemini/gemini-pro-1.5",
    messages=[{"role": "user", "content": prompt}],
)

print(response.choices[0].message.content)
@sverma29-nexturn sverma29-nexturn added the bug Something isn't working label Dec 13, 2024
@jverre
Copy link
Collaborator

jverre commented Dec 17, 2024

Hi @sverma29-nexturn,

Can you try remove the opik_logger and see if you still have the issue ? From the error message it seems to be an issue with the GEMINI_API_KEY rather than Opik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants