Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- **A streamed Mock prompt reports why it stopped** (`MockProvider`). The
mock emitted `end_turn` in its stream but never recorded it, so
`response.finish_reason` was `nil` after a streamed prompt, as it was not
for the real providers. The mock now records it like they do.

- **An evaluation run is executed by one job** (`actionagent`). The run job
read a run's status, then the scenario runner wrote `running`, as two
steps, so a job delivered twice, or two workers that both loaded the run
Expand Down
1 change: 1 addition & 0 deletions lib/active_agent/providers/mock_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def process_stream_chunk(api_response_chunk)
when :message_delta
delta = api_response_chunk[:delta]
message_stack.last[:stop_reason] = delta[:stop_reason] if delta[:stop_reason]
self.stream_finish_reason = delta[:stop_reason] if delta[:stop_reason]

when :message_stop
# Stream complete
Expand Down
11 changes: 11 additions & 0 deletions test/providers/mock_provider_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,17 @@ class MockProviderTest < ActiveSupport::TestCase
assert stream_events.any? { |e| e[:type] == :close }
end

test "a streamed generation reports why it stopped" do
provider = ActiveAgent::Providers::MockProvider.new(
service: "Mock",
messages: [ { role: "user", content: "hello" } ],
stream: true,
stream_broadcaster: ->(_message, _delta, _event_type) { }
)

assert_equal "end_turn", provider.prompt.finish_reason
end

test "returns appropriate response structure" do
response = @provider.prompt

Expand Down
Loading