Skip to content

fix: clean propertyNames for gemini function - #2642

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/gemini-propertyNames
Jan 12, 2026
Merged

fix: clean propertyNames for gemini function#2642
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/gemini-propertyNames

Conversation

@seefs001

@seefs001 seefs001 commented Jan 11, 2026

Copy link
Copy Markdown
Collaborator

fix #2624

Summary by CodeRabbit

  • Bug Fixes
    • Improved schema validation in the Gemini integration by refining parameter cleanup to ensure stricter schema processing.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 11, 2026

Copy link
Copy Markdown
Contributor

Walkthrough

The change adds removal of the "propertyNames" field to the function parameter cleanup logic in the Gemini relay handler. This field is stripped along with other schema-related properties before sending parameters to the API to ensure compatibility with API specifications.

Changes

Cohort / File(s) Summary
Gemini Relay Function Parameter Cleanup
relay/channel/gemini/relay-gemini.go
Added "propertyNames" to the list of root-level fields removed during function parameter sanitization in cleanFunctionParameters. This prevents incompatible schema fields from being passed to the Gemini API.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A tiny tweak, a field away,
propertyNames won't stay,
Schema cleaned with rabbit care,
API errors? Gone—vanished in air! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing propertyNames field for Gemini function declarations, directly addressing the linked issue.
Linked Issues check ✅ Passed The code change removes propertyNames from cleaned function parameters, directly resolving the API error reported in issue #2624 about unknown propertyNames field.
Out of Scope Changes check ✅ Passed The single-line change is narrowly scoped to cleaning propertyNames in Gemini function parameters, remaining fully within the bounds of fixing the reported API error.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62b796f and 138fcd2.

📒 Files selected for processing (1)
  • relay/channel/gemini/relay-gemini.go
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: RedwindA
Repo: QuantumNous/new-api PR: 1537
File: relay/gemini_handler.go:330-342
Timestamp: 2025-08-08T17:12:43.157Z
Learning: In the new-api repository, the `GeminiEmbeddingHandler` function in `relay/gemini_handler.go` is designed specifically for native Gemini embedding requests and therefore does not require the `ConvertGeminiRequest` step that is used in the chat handler. The embedding requests are already in the native Gemini format and don't need conversion.
🔇 Additional comments (1)
relay/channel/gemini/relay-gemini.go (1)

672-679: Good fix: strip propertyNames from function-parameter JSON schema before sending to Gemini.

The cleanFunctionParameters function is indeed recursive and processes nested schemas throughout the full structure—properties, items, allOf/anyOf/oneOf, patternProperties, definitions, $defs, and conditional keywords (if/then/else/not)—so this delete correctly removes propertyNames at any depth, matching the "Unknown name propertyNames" failure.

No existing unit tests found for cleanFunctionParameters. Consider adding a test case that verifies propertyNames is removed at nested depths (e.g., within properties or allOf schemas).


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Calcium-Ion
Calcium-Ion merged commit d73a044 into QuantumNous:main Jan 12, 2026
1 check passed
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
…Names

fix: clean propertyNames for gemini function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants