-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat:Add hallucination correction endpoint and update reranker schema in OpenAPI #56
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
Conversation
WalkthroughThe OpenAPI specification for the Vectara REST API v2 was updated to introduce a new POST endpoint for hallucination correction, including new request and response schemas. The hallucination corrector API group description was revised, and a property in the reranker schema was renamed and updated in its description. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant VectaraAPI
Client->>VectaraAPI: POST /v2/hallucination_correctors/correct_hallucinations\n(HallucinationCorrectionRequest)
VectaraAPI-->>Client: HallucinationCorrectionResponse
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (16)
src/libs/Vectara/Generated/JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.CorrectHallucinations.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.HallucinationCorrectorsClient.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IHallucinationCorrectorsClient.CorrectHallucinations.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IHallucinationCorrectorsClient.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.IVectaraClient.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CorrectionItem.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CorrectionItem.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.CustomerSpecificReranker.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.HallucinationCorrectionRequest.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.HallucinationCorrectionRequest.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.HallucinationCorrectionResponse.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.HallucinationCorrectionResponse.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.HcmSourceDocument.Json.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.Models.HcmSourceDocument.g.csis excluded by!**/generated/**src/libs/Vectara/Generated/Vectara.VectaraClient.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/Vectara/openapi.yaml(4 hunks)
🔇 Additional comments (6)
src/libs/Vectara/openapi.yaml (6)
1907-1944: New hallucination correction endpoint added
ThePOST /v2/hallucination_correctors/correct_hallucinationsendpoint is well-structured, with clear operationId, requestBody, and response definitions. This addition aligns with the PR objectives to introduce hallucination correction capabilities.
5407-5424: Define request schema for hallucination correction
TheHallucinationCorrectionRequestschema correctly requiresgenerated_text,documents, andmodel. The properties are strongly typed and documented.
5426-5434: Define source document schema
TheHcmSourceDocumentschema succinctly captures a single source document with requiredtext. This is a clear and minimal design.
5453-5468: Define CorrectionItem schema
TheCorrectionItemschema correctly captures individual correction entries withoriginal_text,corrected_text, andexplanationall marked as required. This aligns with the intended behavior.
5658-5692: Update Hallucination Correctors tag description
The tag description now accurately reflects both listing and correction operations for hallucination correctors. This provides clear guidance to API consumers.
3414-3417:Details
✅ Verification successful
Rename reranker property to include_context
The schema propertyinclude_contextreplaces the old experimental flag correctly. Please verify that the deprecatedexperimental_use_text_with_contextproperty has been fully removed from all schemas.
🏁 Script executed:
#!/bin/bash # Verify no occurrences of the old experimental property remain rg "experimental_use_text_with_context"Length of output: 39
All occurrences of
experimental_use_text_with_contextremoved
- Ran
rg "experimental_use_text_with_context"across the repository; no matches found.
| required: | ||
| - corrected_text | ||
| - corrections | ||
| type: object | ||
| properties: | ||
| corrections: | ||
| type: array | ||
| items: | ||
| $ref: '#/components/schemas/CorrectionItem' | ||
| description: 'A list of corrections applied to the text, with explanations.' | ||
| corrected_text: | ||
| type: string | ||
| description: 'The revised version of the text, with minimal edits made to correct unsupported or inaccurate statements. If no corrections are needed, this value is identical to the original text.' | ||
| model: | ||
| type: string | ||
| description: The name of the model used for hallucination correction. | ||
| description: The response that contains the hallucination correction results. | ||
| CorrectionItem: |
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.
Make model required in response schema
The HallucinationCorrectionResponse properties include corrected_text, corrections, and model, but only the first two are marked required. According to the API design, the model field should also be required.
Apply this diff to include model in the required list:
required:
- - corrected_text
- - corrections
+ - corrected_text
+ - corrections
+ - model🤖 Prompt for AI Agents (early access)
In src/libs/Vectara/openapi.yaml around lines 5435 to 5452, the 'model' property
in the HallucinationCorrectionResponse schema is not marked as required. Update
the 'required' array to include 'model' along with 'corrected_text' and
'corrections' to ensure the schema correctly reflects that 'model' must be
present in the response.
Summary by CodeRabbit