Repository navigation
Conversation
Add an ollama-cloud entry to the provider registry: OpenAI protocol, base URL https://ollama.com/v1, env OLLAMA_API_KEY, models gpt-oss:120b and gpt-oss:20b. Values match Ollama Cloud's OpenAI-compatible endpoint. Tests cover provider order/count and per-field lookup details. Closes alibaba#305
| BaseURL: "https://ollama.com/v1", | ||
| EnvVar: "OLLAMA_API_KEY", | ||
| Models: []string{ | ||
| "gpt-oss:120b", | ||
| "gpt-oss:20b", | ||
| }, |
There was a problem hiding this comment.
Potential issue: The BaseURL https://ollama.com/v1 does not appear to be a documented or verified Ollama Cloud API endpoint. Ollama is primarily known as a local LLM runtime (default http://localhost:11434), and there is no well-known public cloud API at this URL. Similarly, the model names gpt-oss:120b and gpt-oss:20b do not correspond to any known publicly available models.
Please verify:
- Is this BaseURL correct and currently active?
- Are these model names accurate for this provider?
If this is a placeholder or speculative entry, consider adding a comment or marking it accordingly to avoid confusion.
|
Thanks for the contribution! A few concerns before we can move forward: 1. Endpoint & model verification While issue #305 references Ollama Cloud docs, we'd like confirmation that
2. Tool-calling compatibility OCR's review flow relies heavily on Ideally we'd like to see:
3. Registry ordering Minor nit: the new entry is appended at the end of the registry array, but the sorted test expectation suggests providers are alphabetically ordered at runtime. For source-level consistency, consider placing it between Summary: The code itself is clean and well-tested. The blocker is runtime verification — we'd appreciate a brief test report showing the endpoint works with OCR's tool-calling flow before merging. If tool-calling is not yet reliable, we should document that limitation in the provider entry or PR description. |
…urce Move the ollama-cloud provider block from the end of the registry slice to immediately after minimax (before baidu-qianfan), per PR alibaba#310 review nit from @lizhengfeng101. ListProviders() already sorts output, so this only affects source layout, not runtime order; TestListProviders_Order stays green. Kept Protocol: "openai" as a string literal to match every sibling entry in the registry (minimax, baidu-qianfan, etc. all use the literal, not the ProtocolOpenAIChatCompletions constant).
|
Thanks for the review @lizhengfeng101 — all three points addressed. 🙏 1. Live endpoint verification (
|
| Model | status | tool calls | files | comments | elapsed |
|---|---|---|---|---|---|
gpt-oss:120b |
success | code_comment ×1, file_read ×1 |
2 | 5 | 16s |
gpt-oss:20b |
success | code_comment ×1, file_read ×2 |
2 | 3 | 36s |
Sample comments emitted via the code_comment tool (gpt-oss:120b):
- L6 — "Hardcoding the API token exposes sensitive credentials. Tokens should be injected via environment variables or a secure configuration store."
- L8 — "
riskyDivideperforms division without checking for a zero divisor, which will panic at runtime. Add a guard or return an error." - L13 — "The error from
os.Openis ignored, so a nil file handle can be used later and cause a runtime panic..."
Both models complete the full tool-calling loop (file_read → code_comment) and produce accurate, well-targeted review comments. gpt-oss:20b is slower (36s vs 16s) but functionally correct — no need to drop it.
Raw-API cross-check (one chat/completions call with a tools array) also returns a proper tool_calls response for both models.
3. Registry ordering nit
Done — moved the ollama-cloud block to sit immediately after minimax in the registry source (commit pushed to this branch). ListProviders() already sorts its output, so this is purely source layout; TestListProviders_Order stays green.
One note: I kept Protocol: "openai" as a string literal rather than switching to the ProtocolOpenAIChatCompletions constant — every sibling entry in the registry (minimax, baidu-qianfan, etc.) uses the string literal, so the literal is what keeps this block consistent with its neighbors. Happy to switch the whole registry to the constant in a separate cleanup PR if you'd prefer that direction.
$ go test ./internal/llm/ -run 'TestListProviders_Order|TestLookupProvider_OllamaCloudDetails' -v
PASS
(API key redacted throughout; it was only ever passed via env, never printed.)
|
Thanks for the detailed follow-up and verification, @chethanuk! I want to let you know that #375 has since been submitted, which covers a broader set of models (all 18 currently available on Ollama Cloud's Given the more comprehensive coverage in #375, I'd like to propose merging that one instead. To acknowledge your earlier work on this feature, I'll add you as a Hope that works for you — and thanks again for pioneering this contribution! |
Description
Adds a built-in
ollama-cloudprovider preset to the registry ininternal/llm/providers.go, so Ollama Cloud can be selected directly instead of hand-configured as a custom provider.The preset uses the OpenAI-compatible protocol against
https://ollama.com/v1, reading the API key fromOLLAMA_API_KEY(sent asAuthorization: Bearer <key>, the shared default for OpenAI-protocol entries — no per-providerAuthHeader). It ships two models,gpt-oss:120bandgpt-oss:20b. The base URL, env var, and model naming match Ollama Cloud's documented OpenAI-compatible endpoint.Opened against my own fork first as a staging/review step.
Type of Change
How Has This Been Tested?
gofmt -lreports no diffs,go vet ./internal/llm/is clean, andgo test ./internal/llm/passes (176 tests). Coverage includes the existingTestListProviders_Order(updated for the new sorted position) and a newTestLookupProvider_OllamaCloudDetailsthat pins Protocol, BaseURL, EnvVar, empty AuthHeader, and each model name individually.Whether Ollama Cloud's OpenAI endpoint reliably supports the tool-calls flow that
ocr reviewneeds is a runtime/e2e concern, out of scope for this preset addition.make testpasses locallyChecklist
go fmt,go vet)Related Issues
Closes #305