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

System instruction does not work when creating a context cache. #218

Open
Crymzix opened this issue Jul 30, 2024 · 0 comments
Open

System instruction does not work when creating a context cache. #218

Crymzix opened this issue Jul 30, 2024 · 0 comments
Assignees
Labels
component:js sdk Issue/PR related to JavaScript SDK status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working

Comments

@Crymzix
Copy link

Crymzix commented Jul 30, 2024

Description of the bug:

Declaring a system instruction results in an error when trying to create a context cache:

const cache = await this.genAICache.create({
      model: "models/gemini-1.5-pro-001",
      systemInstruction: "You are an expert software engineer.",
      contents: [
          {
              role: 'user',
              parts,
          },
      ],
})

Actual vs expected behavior:

Actual: GoogleGenerativeAIFetchError: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/cachedContents: [400 Bad Request] Invalid value at 'cached_content.system_instruction' (type.googleapis.com/google.ai.generativelanguage.v1beta.Content), "You are an expert software engineer." [{"@type":"type.googleapis.com/google.rpc.BadRequest","fieldViolations":[{"field":"cached_content.system_instruction","description":"Invalid value at 'cached_content.system_instruction' (type.googleapis.com/google.ai.generativelanguage.v1beta.Content), "You are an expert software engineer.""}]}]

Expected: Cache should be created successfully.

Any other information you'd like to share?

No response

@singhniraj08 singhniraj08 added type:bug Something isn't working status:triaged Issue/PR triaged to the corresponding sub-team component:js sdk Issue/PR related to JavaScript SDK labels Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:js sdk Issue/PR related to JavaScript SDK 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

4 participants