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

Better docs on apiVersion request option #76

Open
roschler opened this issue Mar 30, 2024 · 6 comments
Open

Better docs on apiVersion request option #76

roschler opened this issue Mar 30, 2024 · 6 comments
Assignees
Labels
component:documentation Improvements or additions to documentation status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working

Comments

@roschler
Copy link

I scoured the docs for an example of how to specify the apiVersion parameter in a generate content request. I couldn't find it so I did a hard trace on the fetch() and finally figured out that it has to be in the call to getGenerativeModel():

    const model =
      getGenerativeModel(
        { model: modelName },
        {
            apiVersion: 'v1beta',
            configuration: generationConfig
          },
        );

I believe this is about to trip up a lot of people up due to the huge number of participants in the Google AI Hackathon going on right now. The contest wants you to use the Gemini 1.5 Pro advanced API and that is only available with the v1beta API. So initially my API calls to that model were failing until I figured out how to declare request option that properly.

Post-mortem I did manage to find an example of it buried in the node /advanced-function-calling.js sample. Given it's importance I feel it should be added to the the man repo README page and also at least somewhere on the main API docs page for JavaScript developers:

https://ai.google.dev/tutorials/get_started_web

If you scan that page, you will find many getGenerativeModel() call examples, some even showing how to declare SAFETY settings, but none of them show you where to put the apiVersion option.

@singhniraj08 singhniraj08 added type:bug Something isn't working component:documentation Improvements or additions to documentation status:triaged Issue/PR triaged to the corresponding sub-team labels Apr 1, 2024
@hsubox76
Copy link
Collaborator

hsubox76 commented Apr 1, 2024

That's a good idea, we should put this in more visible places. Let me run this by the docs team, as we'll want to do this consistently for all platforms.

@ara-vardanyan
Copy link

Is 1,5 not available in this SDK? I tried all possible combinations of gemini-1.5-pro, gemini-1.5-pro-x, added v1 beta, etc. I had to switch over to the Vertex SDK in order to use 1.5.

@AliBdeir
Copy link

Not sure why some features are deployed with 0 documentation surrounding them. Since system_instructions is a field you can pass now, I'm assuming you can somehow use 1.5. But there's just 0 documentation on how to do so.

@zakcali
Copy link

zakcali commented Apr 14, 2024

how to set-up "systemInstructions"?
main documentation refers to pythonCode:
model=genai.GenerativeModel( model_name="gemini-1.5-pro-latest", system_instruction="You are a cat. Your name is Neko.")

@zakcali
Copy link

zakcali commented Apr 14, 2024

my answer to my Question:
const model = genAI.getGenerativeModel({ model: "gemini-1.5-pro-latest", systemInstruction: { role: "system", parts: [{ text: "your name is bob" }] }, }, { apiVersion: 'v1beta', generationConfig, safetySettings });

@zakcali
Copy link

zakcali commented Apr 17, 2024

I'm not sure if the opening post is true. Maybe the correct context must be like that
const systemInstruction = { role: "system", parts: [{ text: "Your name is bob" }] }; const model = genAI.getGenerativeModel({ model: "gemini-1.5-pro-latest" , systemInstruction, generationConfig, safetySettings }, { apiVersion});

I mean only { apiVersion: 'v1beta'} is seperate

reference: #101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:documentation Improvements or additions to documentation status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants