-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix CLI warnings #7275
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
base: main
Are you sure you want to change the base?
Fix CLI warnings #7275
Conversation
|
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.
1 issue found across 9 files
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
@@ -145,6 +145,11 @@ function convertJsonSchemaToGeminiSchema(jsonSchema: any): GeminiObjectSchema { | |||
export function convertOpenAIToolToGeminiFunction( | |||
tool: ChatCompletionTool, | |||
): GeminiToolFunctionDeclaration { | |||
// Type guard for function tools | |||
if (tool.type !== "function" || !("function" in tool)) { |
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.
Guard should verify that tool.function is defined, not just that the property name exists
Prompt for AI agents
Address the following comment on packages/openai-adapters/src/util/gemini-types.ts at line 149:
<comment>Guard should verify that tool.function is defined, not just that the property name exists</comment>
<file context>
@@ -145,6 +145,11 @@ function convertJsonSchemaToGeminiSchema(jsonSchema: any): GeminiObjectSchema {
export function convertOpenAIToolToGeminiFunction(
tool: ChatCompletionTool,
): GeminiToolFunctionDeclaration {
+ // Type guard for function tools
+ if (tool.type !== "function" || !("function" in tool)) {
+ throw new Error(`Unsupported tool type: ${tool.type}`);
+ }
</file context>
if (tool.type !== "function" || !("function" in tool)) { | |
if (tool.type !== "function" || !tool.function) { |
This solves the
npm warn deprecated [email protected]: Use your platform's native DOMException instead
error that was showing up due to a dependency in openai version 4 by bumping to version 5. A few type guards were required to handle the new openai types safely. It also adds a few files to .npmignore.