-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix: Resolve custom_metadata propagation and LiteLLM thought parts issues #3973
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
a7059e3
6b4a3a3
19e5aa2
26b665c
0fc53fa
ee6d643
6864401
cd0cef7
4e80ec7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -324,6 +324,7 @@ def get_author_for_event(llm_response): | |||||
| id=Event.new_id(), | ||||||
| invocation_id=invocation_context.invocation_id, | ||||||
| author=get_author_for_event(llm_response), | ||||||
| custom_metadata=invocation_context.run_config.custom_metadata, | ||||||
| ) | ||||||
|
|
||||||
| async with Aclosing( | ||||||
|
|
@@ -438,6 +439,7 @@ async def _run_one_step_async( | |||||
| invocation_id=invocation_context.invocation_id, | ||||||
| author=invocation_context.agent.name, | ||||||
| branch=invocation_context.branch, | ||||||
| custom_metadata=invocation_context.run_config.custom_metadata, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the previous comment,
Suggested change
|
||||||
| ) | ||||||
| async with Aclosing( | ||||||
| self._call_llm_async( | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -533,6 +533,8 @@ async def _get_content( | |
|
|
||
| content_objects = [] | ||
| for part in parts: | ||
| if part.thought: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| continue | ||
| if part.text: | ||
| if len(parts) == 1: | ||
| return part.text | ||
|
|
||
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.
The
invocation_context.run_configis of typeOptional[RunConfig]and could beNone. Accessingcustom_metadatadirectly could lead to anAttributeError. It's safer to usegetattrto avoid this potential runtime error.