Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
baskaryan committed Jan 3, 2024
1 parent d19a665 commit 673d0f5
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions libs/langchain/langchain/chains/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import warnings
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any, Dict, List, Optional, Type, Union
from typing import Any, Dict, List, Optional, Type, Union, cast

import yaml
from langchain_core._api import deprecated
Expand Down Expand Up @@ -353,11 +353,16 @@ def __call__(
A dict of named outputs. Should contain all outputs specified in
`Chain.output_keys`.
"""
config = {
"callbacks": callbacks,
"tags": tags,
"metadata": metadata,
"run_name": run_name,
}

return self.invoke(
inputs,
RunnableConfig(
callbacks=callbacks, tags=tags, metadata=metadata, run_name=run_name
),
cast(RunnableConfig, {k: v for k, v in config.items() if v is not None}),
return_only_outputs=return_only_outputs,
include_run_info=include_run_info,
)
Expand Down Expand Up @@ -399,11 +404,15 @@ async def acall(
A dict of named outputs. Should contain all outputs specified in
`Chain.output_keys`.
"""
config = {
"callbacks": callbacks,
"tags": tags,
"metadata": metadata,
"run_name": run_name,
}
return await self.ainvoke(
inputs,
RunnableConfig(
callbacks=callbacks, tags=tags, metadata=metadata, run_name=run_name
),
cast(RunnableConfig, {k: v for k, v in config.items() if k is not None}),
return_only_outputs=return_only_outputs,
include_run_info=include_run_info,
)
Expand Down

0 comments on commit 673d0f5

Please sign in to comment.