Skip to content

feat(api): add OpenAI Decisions endpoint - #12603

Merged
mudler merged 4 commits into
masterfrom
feat/openai-decisions
Oct 10, 2026
Merged

mudler merged 4 commits into
masterfrom
feat/openai-decisions

Conversation

@mudler-agent

Copy link
Copy Markdown
Collaborator

Description

Add POST /v1/decisions as an OpenAI-compatible REST adapter over LocalAI's existing SystemOne execution. No new inference backend or internal HTTP round trip.

  • Translate predicate, typed choice, and score questions into SystemOne requests and return ordered answers.
  • Share native/NER execution with /v1/systemone; preserve its existing API.
  • Preserve boolean versus string choices, optional question names, empty score labels, and zero-valued results. Derive scores from the returned probability distribution.
  • Apply the existing Decisions permission and usage middleware. Validate malformed backend answers before recording usage.
  • Publish the route in Swagger and the existing systemone instruction group; document examples and compatibility limits.

Notes for Reviewers

This is a local execution adapter, not access to OpenAI's hosted model. Confidence retains local SystemOne semantics. Images reuse existing inline-image validation and backend limits; message text and images are flattened into the existing request format. Unsupported image detail settings are rejected. safety_identifier is accepted as compatibility metadata, not an identity or hosted safety service.

Usage reflects backend-reported counts. Detailed token-accounting objects can be empty when the backend does not provide those fields. Swagger 2 uses documented loose placeholders for JSON unions; runtime choice values remain strings or booleans.

Verification run independently after implementation:

go test ./core/schema ./core/http/auth -count=1
go test -tags auth ./core/schema ./core/http/auth -count=1
go test ./core/http/endpoints/localai -run TestLocalAIEndpoints -count=1
go test ./core/http/routes -run TestRoutes -ginkgo.focus='Decisions|SystemOne' -count=1
go test -tags auth ./core/http/routes -run TestRoutes -ginkgo.focus='Decisions|SystemOne' -count=1
git diff --check

All passed. Tests use a fake backend and exercise HTTP routing, permissions, accounting, conversion, and SystemOne regressions. Protobuf sources were generated and an ignored minimal UI embed fixture supplied for Go route tests. No full native build, GPU inference, or real-model validation was performed.

Swagger was regenerated with github.com/swaggo/swag/cmd/swag@v1.16.6; route/schema references were validated. Changes add only this route and its related definitions.

Signed commits

  • Yes, I signed off my commits (DCO).
  • Documentation updated (docs/content/).

AI assistance is recorded in the commit trailers.

mudler added 4 commits October 9, 2026 20:59
Share SystemOne execution and preserve ordered, typed Decisions answers. Reject null probabilities and derive scores from the emitted distribution. Cover conversion and handler contracts using a valid generated PNG fixture.

Assisted-by: nib:gpt-6-astra
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Keep canonical JSON values in model-visible choice criteria and represent probability label presence explicitly. Add conversion and serialization regressions.

Assisted-by: nib:gpt-6-astra
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Expose the adapter through the shared Decisions feature gate and usage
middleware. Test real route registration with a fake backend, including
unauthenticated access, user permissions, and exact usage accounting.

Assisted-by: nib:gpt-6-astra
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Describe the shared local execution contract, typed questions, image limits, and backend accounting. Publish the Decisions route in Swagger and retain the existing SystemOne discovery tag. Use documented loose object placeholders for JSON unions that Swagger 2 cannot express.

Assisted-by: nib:gpt-6-astra
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
@mudler
mudler merged commit 24a9fee into master Oct 10, 2026
71 of 72 checks passed
@mudler
mudler deleted the feat/openai-decisions branch October 10, 2026 06:29
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.

2 participants