-
Notifications
You must be signed in to change notification settings - Fork 14
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
Update google params transform #91
Conversation
…ion parameters in gemini requests
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: aa87da3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on ff40a16 in 22 seconds
More details
- Looked at
23
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. public-packages/llm-client/src/providers/google/index.ts:60
- Draft comment:
The change from 'additionalProperties' to '_additionalProperties' is not explained. Ensure '_additionalProperties' is correctly set elsewhere. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_PHK80DNdMOHACdt1
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Reviewed everything up to 199439a in 1 minute and 38 seconds
More details
- Looked at
63
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. public-packages/llm-client/src/providers/google/index.ts:59
- Draft comment:
ThecleanSchema
function does not handle nestedadditionalProperties
withinproperties
oritems
. Consider recursively cleaning these nested structures as well. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The code clearly shows recursive handling of nested structures through the cleanSchema function. When it encounters nested properties or items, it calls cleanSchema again which will remove additionalProperties at that level. The comment appears to be incorrect in its assessment.
Could there be some edge cases or specific nested structures that the current implementation doesn't handle? The recursive approach seems sound but maybe there's something subtle I'm missing.
No, the implementation is thorough - it handles both properties and items recursively, and the destructuring of additionalProperties happens at each level. The comment is simply incorrect.
Delete this comment as it incorrectly claims the code doesn't handle nested structures, when it clearly does through recursive calls to cleanSchema.
Workflow ID: wflow_yhL0R1ODsm0KWDwm
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 2cb5349 in 50 seconds
More details
- Looked at
1107
lines of code in4
files - Skipped
0
files when reviewing. - Skipped posting
5
drafted comments based on config settings.
1. apps/www/.source/index.js:6
- Draft comment:
The reordering of import statements is purely organizational and does not affect functionality. Ensure this aligns with your project's style guidelines. - Reason this comment was not posted:
Confidence changes required:10%
The import statements in theindex.js
file have been reordered, but the change seems to be purely organizational. This doesn't affect functionality but could improve readability.
2. public-packages/llm-client/src/providers/google/index.ts:160
- Draft comment:
ThecreateGenerationConfig
function correctly maps parameters fromGoogleChatCompletionParams
toGenerationConfig
. This ensures proper configuration for chat sessions. - Reason this comment was not posted:
Confidence changes required:10%
ThecreateGenerationConfig
function inindex.ts
is correctly mapping parameters fromGoogleChatCompletionParams
toGenerationConfig
. This ensures that the configuration is properly set for the chat session.
3. public-packages/llm-client/src/providers/google/index.ts:178
- Draft comment:
ThetransformHistory
function correctly filters out system messages and transforms the remaining messages into the required format for Google's API. - Reason this comment was not posted:
Confidence changes required:10%
ThetransformHistory
function inindex.ts
is correctly filtering out system messages and transforming the remaining messages into the required format. This is important for maintaining the correct chat history format for Google's API.
4. public-packages/llm-client/src/providers/google/index.ts:223
- Draft comment:
ThegetChatSession
function effectively manages chat sessions, including caching and session reuse, which is crucial for performance and resource management. - Reason this comment was not posted:
Confidence changes required:10%
ThegetChatSession
function inindex.ts
is responsible for managing chat sessions, including caching and session reuse. This is crucial for performance and resource management.
5. public-packages/llm-client/src/providers/google/index.ts:292
- Draft comment:
ThetransformResponse
function effectively converts API responses into a structured format, including grounding metadata and tool calls, which is essential for detailed responses. - Reason this comment was not posted:
Confidence changes required:10%
ThetransformResponse
function inindex.ts
is responsible for converting the API response into a format that includes grounding metadata and tool calls. This is essential for providing detailed and structured responses.
Workflow ID: wflow_IAIYu20YQlFWbgSM
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
* Gets system instructions from messages | ||
*/ | ||
private getSystemInstructions(messages: GoogleChatCompletionParams["messages"]): string { | ||
const systemMessages = messages.filter(message => message.role === "system") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use reduce to only use one pass for really long conversations but perf is prob negligible in the vast majority of cases
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah fair - this was actually just form before splitting things up a bit, but google does support system messages so next push will bring that in and remove this entirely
): ExtendedCompletionGoogle | ExtendedCompletionChunkGoogle { | ||
const responseText = responseDataChunk.text() | ||
const toolCalls = | ||
responseDataChunk.candidates?.[0]?.content?.parts?.flatMap(part => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth null checking candidates?
let contentWithGrounding = responseText | ||
let sources: Array<{ url: string; title: string }> = [] | ||
|
||
if (groundingMetadata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
id: `chatcmpl-${Math.random().toString(36).slice(2)}`, | ||
object: stream ? "chat.completion.chunk" : "chat.completion", | ||
created: Date.now(), | ||
model: "gemini-pro", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe 1.0 pro is deprecated, but we should be using the dynamically passed model regardless no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeaha this was what was there - - we actualyl dont have the passed in params in this point so its hard coded, but yeah it should be the user provided param not this value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😶🌫️ somehow that was missed on the original PR my b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on dbaecbf in 45 seconds
More details
- Looked at
819
lines of code in5
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. public-packages/llm-client/src/providers/google/index.ts:176
- Draft comment:
message.content.toString()
can be simplified tomessage.content
since it's already a string. - Reason this comment was not posted:
Confidence changes required:50%
ThetransformHistory
function is mappingmessage.content
totext
usingtoString()
. This is unnecessary sincemessage.content
is already a string. This can be simplified by removingtoString()
.
Workflow ID: wflow_FZro9E5MUFDTMSdF
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
… the resposne that google doesnt provide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on c58584a in 21 seconds
More details
- Looked at
65
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. public-packages/llm-client/src/providers/google/index.ts:278
- Draft comment:
Update the comment to reflect the change in parameters from a boolean toGoogleChatCompletionParams
. - Reason this comment was not posted:
Confidence changes required:50%
The PR changes the parameter from a boolean to an object, which is a good change for extensibility. However, the comment on line 277 still refers to the old parameter type.
2. public-packages/llm-client/src/providers/google/index.ts:389
- Draft comment:
Update the comment to reflect the change in parameters from a boolean toGoogleChatCompletionParams
. - Reason this comment was not posted:
Confidence changes required:50%
The PR changes the parameter from a boolean to an object, which is a good change for extensibility. However, the comment on line 389 still refers to the old parameter type.
Workflow ID: wflow_deabnF2znfAyoH02
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 708ec64 in 39 seconds
More details
- Looked at
31
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. public-packages/llm-client/src/types/index.ts:9
- Draft comment:
GoogleGenerativeAI
is imported but not used. Consider removing it to clean up the code. - Reason this comment was not posted:
Comment was on unchanged code.
Workflow ID: wflow_OEH4SFW8yypM4Qy9
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on 4378126 in 20 seconds
More details
- Looked at
11
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. .changeset/afraid-rings-cough.md:5
- Draft comment:
The changeset description is too vague. Please provide a more detailed description of the changes made, including specific features or fixes implemented. - Reason this comment was not posted:
Comment did not seem useful.
Workflow ID: wflow_DlcpVSx9ddJeb3ln
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good to me! Incremental review on aa87da3 in 16 seconds
More details
- Looked at
13
lines of code in1
files - Skipped
0
files when reviewing. - Skipped posting
1
drafted comments based on config settings.
1. public-packages/llm-client/tests/google.test.ts:204
- Draft comment:
Removing theconsole.log
statement is a good practice for cleaner test output and avoiding unnecessary logging. - Reason this comment was not posted:
Confidence changes required:10%
The removal of the console.log statement is appropriate for production code, as it prevents unnecessary logging and potential exposure of sensitive information.
Workflow ID: wflow_jCOPJNUn6SEk1m6G
You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
Important
Enhances Google Gemini API support in
llm-polyglot
with grounding, safety settings, session management, and updates documentation and tests.llm-polyglot
with grounding, safety settings, session management, and more.additionalProperties
from function parameters in Gemini requests.google.mdx
andREADME.md
to reflect new features and usage examples.index.ts
insrc/providers/google
to handle new features and clean schemas.index.js
to reorder imports for documentation files.google.test.ts
for new features like grounding and session management.This description was created by
for aa87da3. It will automatically update as commits are pushed.