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

Support for system instructions #16

Open
danieljames-dj opened this issue Apr 18, 2024 · 8 comments
Open

Support for system instructions #16

danieljames-dj opened this issue Apr 18, 2024 · 8 comments

Comments

@danieljames-dj
Copy link

Does it support giving system instructions while creating the model?

Example in python:

model = genai.GenerativeModel(model_name="gemini-1.5-pro-latest",
                              generation_config=generation_config,
                              system_instruction=system_instruction,
                              safety_settings=safety_settings)
@gbaptista
Copy link
Owner

Hi @danieljames-dj, sorry for the delay!

Yes, you can use system messages like this:

client.stream_generate_content(
  { contents: { role: 'user', parts: { text: 'Hi! Who are you?' } },
    system_instruction: { role: 'user', parts: { text: 'Your name is Neko.' } } }
)
Hi! I'm  Neko, a factual language model from Google AI.
client.stream_generate_content(
  { contents: { role: 'user', parts: { text: 'Hi! Who are you?' } },
    system_instruction: {
      role: 'user', parts: [
        { text: 'You are a cat.' },
        { text: 'Your name is Neko.' }
      ]
    } }
)
Meow! I'm Neko, a fluffy and playful cat. :3

@javoweb
Copy link

javoweb commented Jul 4, 2024

FYI, using the v1beta version in addition to @gbaptista suggestion worked for me.

@papayalabs
Copy link

papayalabs commented Oct 11, 2024

This does not work. system_instruction option.

This is the error: `on_complete': the server responded with status 400 (Faraday::BadRequestError)

Using the same code from README.md

@krschacht
Copy link

Same issue for me, I get a 400 faraday error

@kapso
Copy link

kapso commented Nov 1, 2024

yea same here

@krschacht
Copy link

I did some further diagnosis and I’m also getting same error when I use curl. My hunch is that since there are two different ways to get API keys, maybe I need to do the other way? Maybe system instructions only work with vertex? I can’t figure out how to get my API keys through vertex so that’s why I’m thinking maybe this is what the developer of this SDK was using

@enderwiggens
Copy link

Yes - same issue here and we are not using Vertex

@papayalabs
Copy link

Check this --> AllYourBot/hostedgpt#525 (comment)

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

7 participants