Skip to content

Integrate dynamic profiles with Ollama Tool loops - #348

Open
qoli wants to merge 61 commits into
huggingface:mainfrom
qoli:codex/upstream-profile-ollama
Open

qoli wants to merge 61 commits into
huggingface:mainfrom
qoli:codex/upstream-profile-ollama

Conversation

@qoli

@qoli qoli commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Scope

Ollama integration for #315's shared Compatibility SPI. Provider PRs are siblings, not a chain.

Depends on #315 cf4ad0d, transitively #314/#313 and main's #352. Isolated layer comparison.

  • Resolve a profile before each actual request and bind callbacks/Tools to that producing request.
  • Preserve canonical/pending history, earlier text, shared nondefault round budgets and the full handoff error payload.
  • Retain ordinary provider history behavior; preserve repeated calls and round-scoped outputs rather than globally deduplicating call IDs.
  • Retain complete committed-entry identity for hooks/Tools and the public raw-Tool boundary.

Preserve upstream ChatReply.response() error validation. Tool definitions and execution lookup both honor the producing request's toolsOffered list, including disallowed mode. The reused-ID fixture sends actual call_0 values. Existing ordinary non-streaming continuation is retained; the requested separate PR remains an outstanding decision, not silently removed or created here.

Upstream 1.1 synchronization

Normal history-preserving merges synchronize upstream main 7d43219, including #357 per-request usage accounting, #341 Ollama reasoning, #358 host-scoped Chat Completions reasoning, #300 response-start timeouts, #362 cancellation collection, #364 partial structured snapshots and #366/#367 bounds/reasoning/system-Tool fixes. Earlier #336 final-request usage, #340 HTTPTransport, #297/#325/#331/#343/#352/#354/#356 remain intact. No force-push, new checkout, replacement PR or extra fallback.

Ollama thinking is preserved in ordinary/profile streaming and non-streaming continuations, canonical entries and Codable replay, with a typed .ollama origin. Reasoning callbacks run for the producing profile before Tool-output callbacks switch it; the round budget is checked before the unexecuted round's reasoning is appended. New request-body/Codable/callback and error-payload cases first failed, then passed. Existing ordinary non-streaming continuation, ChatReply.response() validation, toolsOffered execution filtering and actual reused call IDs remain unchanged; no standalone continuation PR is created here.

Fresh local verification (2026-10-23)

Head cad7b1b. CI=1 GIT_CONFIG_GLOBAL=/dev/null swift test: 958 tests / 100 suites passed. The separate upstream macro test target also passed 2 tests / 1 suite. Strict formatting/diff checks passed. These are compile/offline tests, not live API, model-weight or Apple Intelligence inference acceptance.

The existing ordinary/profile non-streaming final-usage regression remains covered, including a final request with no usage and the unchanged two-request continuation path. The offline suites retain streaming/non-streaming history, callback, reused-ID and handoff accounting regressions. Constructor visibility is still SPI; no new PR or force-push.

qoli added 30 commits October 9, 2026 16:06
…dynamic-profiles

# Conflicts:
#	Sources/AnyLanguageModel/LanguageModelSession.swift
#	Sources/AnyLanguageModel/SessionProperties.swift
#	Sources/AnyLanguageModelMacros/SessionPropertyEntryMacro.swift
#	Tests/AnyLanguageModelTests/APICompatibilityAnyLanguageModelTests.swift
#	Tests/AnyLanguageModelTests/APICompatibilityFoundationModelsTests.swift
#	Tests/AnyLanguageModelTests/SessionPropertyTests.swift
…dynamic-profiles

# Conflicts:
#	Sources/AnyLanguageModel/SessionProperties.swift
#	Tests/AnyLanguageModelTests/SessionPropertyTests.swift
…dynamic-profiles

# Conflicts:
#	Sources/AnyLanguageModel/LanguageModelSession.swift
…ofile-tool-continuations

# Conflicts:
#	Sources/AnyLanguageModel/DynamicProfile.swift
#	Sources/AnyLanguageModel/LanguageModelSession.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant