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

Possible genAI error? #47

Closed
CopyNinja1999 opened this issue Oct 9, 2024 · 2 comments
Closed

Possible genAI error? #47

CopyNinja1999 opened this issue Oct 9, 2024 · 2 comments

Comments

@CopyNinja1999
Copy link

Invoking gemini-flash using the proxy became erroneous this morning while gemini-pro didn't.
error msg:
genai send message error: proto:\xa0(line 14:3): unknown field "usageMetadata"

to reproduce the error, run:

import requests
import json
model="gpt-4"
api_key="Your api key"
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {api_key}"
}
messages=[{"role": "user", "content": "hello"}]
data = {
    "model": model,
    "messages": messages,
    "temperature": 0.7,
    "safetySettings": 
        [
    {
        "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
        "threshold": "BLOCK_NONE"
    },
                {
        "category": "HARM_CATEGORY_HARASSMENT",
        "threshold": "BLOCK_NONE"
    },
                                        {
        "category": "HARM_CATEGORY_HATE_SPEECH",
        "threshold": "BLOCK_NONE"
    },{
        "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
        "threshold": "BLOCK_NONE"
    }
                                        
]
}
url = "https://gemini-oxy-demo-wexkspkivl.ap-southeast-1.fcapp.run/v1/chat/completions"
response = requests.post(url, headers=headers, data=json.dumps(data))
response.json()

wonder if it is an genAI error or this project?

@CopyNinja1999
Copy link
Author

resource that might related:
google/generative-ai-go#97
which is an issue raised in May, should have been fixed long ago.

@zhu327
Copy link
Owner

zhu327 commented Oct 28, 2024

#49

@zhu327 zhu327 closed this as completed Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants