Closed Raj725 closed 19 minutes ago
I have identified the solution to the issue. However, I believe this problem is prevalent across multiple Langchain modules wherever SettingsConfigDict
is utilized. I am raising a PR to address the fix for _O365Settings
.
Checked other resources
Example Code
from langchain_community.document_loaders import SharePointLoader
sp_loader = SharePointLoader( document_library_id="drive-id", )
docs = sp_loader.load()
Error Message and Stack Trace (if applicable)
pydantic_core._pydantic_core.ValidationError: 2 validation errors for _O365Settings openai_api_key Extra inputs are not permitted [type=extra_forbidden, input_value='sk-proj-AwsD-exKM2Mq-p4W...mSSZU1xSCpf8O022nVA3tIA', input_type=str] For further information visit https://errors.pydantic.dev/2.9/v/extra_forbidden pg_connection_string Extra inputs are not permitted [type=extra_forbidden, input_value='postgresql://postgres:xxxxxxxx/postgres', input_type=str] For further information visit https://errors.pydantic.dev/2.9/v/extra_forbidden
Description
I am encountering a
pydantic_core._pydantic_core.ValidationError
when trying to use theSharePointLoader
, which internally loads_O365Settings
from the.env
file. The error indicates that extra inputs are not permitted, causing the validation to fail.The issue appears to be due to additional fields (
openai_api_key
andpg_connection_string
) in the.env
file that are not defined in the_O365Settings
class. This results in the validation failing with theextra_forbidden
error type.My
.env
file looks like:System Info
System Information
Package Information
Optional packages not installed
Other Dependencies