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

Fix count tokens to include model params #209

Merged
merged 3 commits into from
Jul 15, 2024
Merged

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
8 checks passed
@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