Skip to content

Conversation

@Stoic-Angel
Copy link
Contributor

Description

Type of Change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Your pull-request will likely not be merged unless it is covered by some form of impactful unit testing.

  • I added new unit tests to cover this change

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added Google Colab support for the newly added notebooks.
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I ran uv run make format; uv run make lint to appease the lint gods

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Sep 3, 2025
Copy link
Member

@AstraBert AstraBert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just two minor comments :)

current_agent_name: str
tool_calls: list[ToolSelection] = Field(default_factory=list)
raw: Optional[Any] = Field(default=None, exclude=True)
thinking_delta: str = Field(default="")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use default_factorty = str. Non-blocking, tho

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some more comprehensive test that mocks the execution of an agent and streams the thinking delta? Just to make sure that everything is captured correctly

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Sep 3, 2025
@Stoic-Angel
Copy link
Contributor Author

Stoic-Angel commented Sep 3, 2025

on a side note: @AstraBert do you think we could possibly modularise the CI tests, i.e. focusing on smaller sub-packages for any particular change? just curious :)

@AstraBert
Copy link
Member

AstraBert commented Sep 3, 2025

For sub-packages like integrations, tests happen directly for those packages that have been changed, but for changes occurring in llama-index-core we want to make sure no unintended breaks are introduced, and the only way to do it is to always test for all core modules, even when the change is contained... Hope this explanation helps!

Copy link
Member

@AstraBert AstraBert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 3, 2025
@AstraBert AstraBert merged commit 3a22872 into run-llama:main Sep 3, 2025
11 checks passed
@Stoic-Angel
Copy link
Contributor Author

Of course, makes sense. Thank you! :D

@iKotori96
Copy link

Perhaps using last_chat_response.message.additional_kwargs.get("thinking_delta", "") is a more reasonable choice.

@Stoic-Angel
Copy link
Contributor Author

Stoic-Angel commented Sep 5, 2025

Valid question. In Ollama's ChatResponse implementation, the message param contains the FULL thinking text. When I fetch the thinking_delta however (which is not in message but in ChatResponse only), the response is returned chunk by chunk (since it's looping over r in response), thereby enabling streaming. I think that's better.

@Stoic-Angel Stoic-Angel deleted the thinking branch September 10, 2025 21:28
frankiekim5 pushed a commit to frankiekim5/bedrock-agentcore-memory that referenced this pull request Sep 24, 2025
…soning (feat: [19270]) (run-llama#19785)

* add thinking_delta field to AgentStream events to expose Ollama's reasoning

* adds more tests and updates default handling

* fixes :(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Expose Ollama "thinking" in FunctionAgent's AgentStream

3 participants