Skip to content
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

Fix type hint for FileChunkingStrategyParam to use StaticFileChunkingStrategyObject #2014

Closed
wants to merge 1 commit into from

Conversation

Programmer-RD-AI
Copy link

This PR addresses and resolves the issue referenced in GitHub Issue #2005. The current type hint for FileChunkingStrategyParam caused API errors when passing a StaticFileChunkingStrategyParam, resulting in a 400 error due to a missing parameter ('chunking_strategy.type').

Summary of Changes:

  • Replaced StaticFileChunkingStrategyParam with StaticFileChunkingStrategyObject in the type alias for FileChunkingStrategyParam.
  • This ensures that the correct API structure is used, which resolves the issue of the missing 'chunking_strategy.type' parameter.
FileChunkingStrategyParam: TypeAlias = Union[AutoFileChunkingStrategyParam, StaticFileChunkingStrategyObject]

Issue Addressed (#2005):

  • The API error (400 - Missing required parameter: 'chunking_strategy.type') was caused by the incorrect type hint. Using StaticFileChunkingStrategyObject aligns with the expected API input and resolves the error.
  • The error only occurred when StaticFileChunkingStrategyParam was passed directly, so this fix aligns the type hinting with the actual API expectations.

Concerns & Future Exploration:

  • AutoFileChunkingStrategyParam lacks a static field, which StaticFileChunkingStrategyObject includes. This inconsistency could lead to issues in the future if similar expectations arise for AutoFileChunkingStrategyParam. I plan to further explore this potential gap in the future.

Checklist:


Thank you for considering this PR! Please feel free to share any feedback or suggestions, and I’ll be happy to address them. 😊

…StrategyObject

Updated the type alias for FileChunkingStrategyParam to replace StaticFileChunkingStrategyParam
with StaticFileChunkingStrategyObject to align with the correct API structure and resolve type errors.
@RobertCraigie
Copy link
Collaborator

Thanks for the PR, we fixed this separately and it'll be included in the next release #2013

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