Skip to content

Conversation

@hsubox76
Copy link
Collaborator

Count tokens request should include any params set on the model parent class, including systemInstruction, tools, cachedContent.

Updated samples to use this.

generationConfig, toolConfig, and safetySettings don't seem like they would affect tokenCount but might as well pass them through, as they are part of a complete GenerateContentRequest and may affect tokenCount in the future.

// cachedContent: modelParams?.cachedContent?.name,
// contents: [],
// },
// };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, thanks!

model: "gemini-1.5-flash",
});
// expect(result.generateContentRequest.model).to.equal("gemini-1.5-flash");
// expect(result.generateContentRequest.contents).to.equal("gemini-1.5-flash");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@hsubox76 hsubox76 marked this pull request as ready for review July 15, 2024 17:54
@hsubox76 hsubox76 merged commit e87d5b0 into main Jul 15, 2024
@hsubox76 hsubox76 deleted the ch-fix-count-tokens branch July 15, 2024 17:58
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

Successfully merging this pull request may close these issues.

2 participants