Skip to content

Conversation

richedperson1
Copy link

@richedperson1 richedperson1 commented Sep 5, 2025

This PR introduces two improvements:

  1. In the Qdrant provider, the creation of the payload index for the "project_id" field has been updated to explicitly set the field schema using models.PayloadSchemaType.KEYWORD. This change ensures that the data type is correctly interpreted by Qdrant, leading to more reliable indexing and search operations.

  2. In the chart generation pipeline, the JSON file loading has been updated to enforce encoding="utf-8". This ensures consistent behavior when reading configuration files across various environments.

Both improvements are aimed at enhancing compatibility and reliability of the document

Summary by CodeRabbit

  • Bug Fixes
    • Prevented encoding-related errors by explicitly loading chart schemas as UTF-8, improving cross-platform consistency when parsing Vega-Lite schemas.
  • Chores
    • Aligned vector store payload indexing with official enum types for improved type safety and configuration robustness.

Copy link
Contributor

coderabbitai bot commented Sep 5, 2025

Walkthrough

Whitespace-only edits to two binary file open statements in eval preparation; explicit UTF-8 encoding added when opening Vega-Lite schema JSON in two chart pipeline initializers; Qdrant payload index configured using models.PayloadSchemaType.KEYWORD with an added import. No public APIs or control flow changed.

Changes

Cohort / File(s) Summary of Changes
Eval prep file open whitespace
wren-ai-service/eval/preparation.py
Whitespace-only change in two binary file opens (e.g., with open(path, "rb") as f:with open(path, "rb")as f:). No functional change; reading remains binary and parsed with orjson.
Vega‑Lite schema loading
wren-ai-service/src/pipelines/generation/chart_adjustment.py, wren-ai-service/src/pipelines/generation/chart_generation.py
Open Vega‑Lite schema JSON with explicit encoding="utf-8" in initializers; schema loading and subsequent logic unchanged.
Qdrant payload index type
wren-ai-service/src/providers/document_store/qdrant.py
Added from qdrant_client.http import models and use models.PayloadSchemaType.KEYWORD instead of the string "keyword" for field_schema.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

wren-ai-service

Suggested reviewers

  • yichieh-lu
  • paopa

Poem

I nibbled bytes by lantern light,
Ensured UTF‑8 would read them right.
Swapped a string for enum delight,
Payloads indexed, tidy and tight.
A rabbit hops — the code feels light! 🐇


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2be1f65 and c10fed5.

📒 Files selected for processing (1)
  • wren-ai-service/eval/preparation.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • wren-ai-service/eval/preparation.py
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🧹 Nitpick comments (2)
wren-ai-service/src/pipelines/generation/chart_generation.py (1)

141-141: UTF-8 read is good; tiny PEP8 nit on spacing

Style nit: add a space after the comma before encoding for readability.

-with open("src/pipelines/generation/utils/vega-lite-schema-v5.json", "r",encoding="utf-8") as f:
+with open("src/pipelines/generation/utils/vega-lite-schema-v5.json", "r", encoding="utf-8") as f:
wren-ai-service/src/pipelines/generation/chart_adjustment.py (1)

168-168: UTF-8 read looks good; minor spacing nit

Same spacing nit as the generation pipeline.

-with open("src/pipelines/generation/utils/vega-lite-schema-v5.json", "r",encoding="utf-8") as f:
+with open("src/pipelines/generation/utils/vega-lite-schema-v5.json", "r", encoding="utf-8") as f:
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d321f87 and 2be1f65.

📒 Files selected for processing (4)
  • wren-ai-service/eval/preparation.py (2 hunks)
  • wren-ai-service/src/pipelines/generation/chart_adjustment.py (1 hunks)
  • wren-ai-service/src/pipelines/generation/chart_generation.py (1 hunks)
  • wren-ai-service/src/providers/document_store/qdrant.py (2 hunks)
🔇 Additional comments (1)
wren-ai-service/src/providers/document_store/qdrant.py (1)

4-4: Reuse existing rest alias for PayloadSchemaType; drop models import

Replace models.PayloadSchemaType.KEYWORD with rest.PayloadSchemaType.KEYWORD and remove the from qdrant_client.http import models import (pinned qdrant-client 1.11.0 already supports PayloadSchemaType.KEYWORD).

@richedperson1 richedperson1 changed the title Update Qdrant: set field_schema to KEYWORD & add encoding="utf-8" for file opening Fix/Update Qdrant: set field_schema to KEYWORD & add encoding="utf-8" for file opening Sep 5, 2025
Remove the encoding="utf-8" parameter from the open() calls at lines 92-93 and 213-214. Binary mode (i.e. using "rb") is mandatory for orjson.loads to function properly and to prevent a TypeError. An alternative would be to open the file in text mode if a string is used.
@cyyeh
Copy link
Member

cyyeh commented Sep 8, 2025

@richedperson1 it seems we already provide "keyword" as PayloadSchemaType?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants