-
Notifications
You must be signed in to change notification settings - Fork 16k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support returning run info for llms, chat models and chains #5666
Conversation
@@ -108,6 +108,8 @@ def __call__( | |||
inputs: Union[Dict[str, Any], Any], | |||
return_only_outputs: bool = False, | |||
callbacks: Callbacks = None, | |||
*, | |||
include_run_info: bool = False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why make this optional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly for better bw-compat, we have a bunch of existing tests that check the returned dict from __call__
and expect it not to have a __run
field. Other people might have tests like that too.
@@ -93,6 +94,8 @@ def generate( | |||
generations = [res.generations for res in results] | |||
output = LLMResult(generations=generations, llm_output=llm_output) | |||
run_manager.on_llm_end(output) | |||
if run_manager: | |||
output.run = RunInfo(run_id=run_manager.run_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be RUN_KEY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately you cannot set underscore keys in pydantic objects, i.e. LLMResult
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow these python libraries are something else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could set the alias then serialize with by_alias=True
though maybe that's even more complicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah... seems more complex than it needs to imo
…n-ai#5666) returning the run id is important for accessing the run later on
returning the run id is important for accessing the run later on