fix(langchain): handle optional serialized values gracefully #1047
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.
Important
Handle optional serialized values gracefully in
langchain.pyandextract_model.pyby updating functions to acceptNoneand adding error handling.get_langchain_run_name()inlangchain.pyto handleNoneforserializedargument, using try-except blocks for key access._extract_model_name()inextract_model.pyto acceptNoneforserialized, adjusting logic to prevent errors.serializedparameter type fromDict[str, Any]toOptional[Dict[str, Any]]in multiple functions inlangchain.pyandextract_model.py, includingon_chain_start(),on_llm_start(), and_extract_model_by_path_for_id().Nonein_extract_model_from_repr_by_pattern()and_extract_model_by_path()inextract_model.py.langchain.pyto reflect changes in parameter types and behavior.This description was created by
for b1a3ce6. It will automatically update as commits are pushed.