langchain_community: Add default None values to DocumentAttributeValue class properties (#28785)

**Description**: 
This PR addresses an issue where the DocumentAttributeValue class
properties did not have default values of None. By explicitly setting
the Optional attributes (DateValue, LongValue, StringListValue, and
StringValue) to default to None, this change ensures the class functions
as expected when no value is provided for these attributes.

**Changes Made**:
Added default None values to the following properties of the
DocumentAttributeValue class:
DateValue
LongValue
StringListValue
StringValue
Removed the invalid argument extra="allow" from the BaseModel
inheritance.
Dependencies: None.

**Twitter handle (optional)**: @__korikori1021

**Checklist**
- [x] Verified that KendraRetriever works as expected after the changes.

Co-authored-by: y1u0d2a1i <y.kotani@raksul.com>
This commit is contained in:
Yudai Kotani 2024-12-18 23:43:04 +09:00 committed by GitHub
parent 90f7713399
commit 05a44797ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -119,13 +119,13 @@ class AdditionalResultAttribute(BaseModel, extra="allow"): # type: ignore[call-
class DocumentAttributeValue(BaseModel, extra="allow"): # type: ignore[call-arg]
"""Value of a document attribute."""
DateValue: Optional[str]
DateValue: Optional[str] = None
"""The date expressed as an ISO 8601 string."""
LongValue: Optional[int]
LongValue: Optional[int] = None
"""The long value."""
StringListValue: Optional[List[str]]
StringListValue: Optional[List[str]] = None
"""The string list value."""
StringValue: Optional[str]
StringValue: Optional[str] = None
"""The string value."""
@property