Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Add ability to set modelParams on getGenerativeModelFromCachedContent()#254

Merged
hsubox76 merged 2 commits into
mainfrom
ch-add-model-params
Sep 11, 2024
Merged

Add ability to set modelParams on getGenerativeModelFromCachedContent()#254
hsubox76 merged 2 commits into
mainfrom
ch-add-model-params

Conversation

@hsubox76

@hsubox76 hsubox76 commented Sep 10, 2024

Copy link
Copy Markdown
Collaborator

Add a modelParams arg to getGenerativeModelFromCachedContent(), allowing users to set generationConfig and safetySettings.

@hsubox76 hsubox76 marked this pull request as ready for review September 10, 2024 19:21

@dlarocque dlarocque left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is the failed node integration test a flake?

apiKey: string;
getGenerativeModel(modelParams: ModelParams, requestOptions?: RequestOptions): GenerativeModel;
getGenerativeModelFromCachedContent(cachedContent: CachedContent, requestOptions?: RequestOptions): GenerativeModel;
getGenerativeModelFromCachedContent(cachedContent: CachedContent, modelParams?: Partial<ModelParams>, requestOptions?: RequestOptions): GenerativeModel;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why do we make this Partial<>? Is ModelParams.model only optional when it's passed to this method?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

None of the params are required here, and the whole object is optional, because cachedContent should have everything it needs to initialize (it always has "model").

@dlarocque dlarocque self-requested a review September 11, 2024 18:06
@hsubox76 hsubox76 merged commit fc008a1 into main Sep 11, 2024
@hsubox76 hsubox76 deleted the ch-add-model-params branch September 11, 2024 19:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants