Fix: Add missing text_contents parameter to add_contents method signature #5239
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The synchronous
add_contentsmethod was missing thetext_contentsparameter in its type signature and docstring, while the asyncadd_contents_asyncmethod had it correctly defined. This caused confusion and prevented proper IDE autocomplete and type checking when users tried to useknowledge.add_contents(text_contents=[...]).Key changes:
text_contents: Optional[List[str]]parameter to theadd_contentsmethod overloadtopics,reader, andremote_contentparameters for consistency with the async versionThis fix resolves a GitHub issue where users reported that the parameter "contents" in
knowledge.add_contentswas incorrect and should be "text_contents".Type of change
Checklist
./scripts/format.shand./scripts/validate.sh)Additional Notes
The implementation of
add_contentsalready forwarded all arguments correctly toadd_contents_asyncusing*args, **kwargs, so only the type signature and documentation needed updating. No behavior changes were made - this is purely a fix for the public API definition.Existing cookbook examples in
cookbook/knowledge/basic_operations/15_text_content.pyalready demonstrate correct usage of thetext_contentsparameter with the async version.solves #5232