[PR #13416] [MERGED] docs: add docs for v1/responses and rework openai compat section #24738

Closed
opened 2026-04-19 17:46:38 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/13416
Author: @drifkin
Created: 12/11/2025
Status: Merged
Merged: 12/12/2025
Merged by: @drifkin

Base: mainHead: drifkin/v1-responses-docs


📝 Commits (3)

  • 0e27dd3 docs: add docs for v1/responses and rework openai compat section
  • 9d38fae Update docs/api/openai-compatibility.mdx
  • b8e4153 Update docs/api/openai-compatibility.mdx

📊 Changes

3 files changed (+320 additions, -147 deletions)

View changed files

📝 docs/api/openai-compatibility.mdx (+137 -147)
docs/tools/extract-examples/README.md (+46 -0)
docs/tools/extract-examples/main.go (+137 -0)

📄 Description

(this is intended to be merged once #13351 is released)

I reworked the examples to be separated by topic and to be fully runnable (i.e., they now log output instead of just suggesting how a call might be made).

We now use <CodeGroup>s so that each example has a dropdown on the docs site for users to choose, which makes the examples a lot more digestible (since you only see approx 1/3 of the code you used to).

I also added a new tool to extract code examples into files so that it's easier to actually run them and check that they work.

Example

go run docs/tools/extract-examples/main.go docs/api/openai-compatibility.mdx

Output:

Extracting code examples to: /var/folders/vq/wfm2g6k917d3ldzpjdxc8ph00000gn/T/mdx-examples-3271754368

  - 01_basic.py
  - 01_basic.js
  - 01_basic.sh
  - 02_responses.py
  - 02_responses.js
  - 02_responses.sh
  - 03_vision.py
  - 03_vision.js
  - 03_vision.sh

Extracted 9 file(s) to /var/folders/vq/wfm2g6k917d3ldzpjdxc8ph00000gn/T/mdx-examples-3271754368

To run examples:

  cd /var/folders/vq/wfm2g6k917d3ldzpjdxc8ph00000gn/T/mdx-examples-3271754368
  npm install   # for JS examples

then run individual files with `node file.js`, `python file.py`, `bash file.sh`

In the future we should consider actually running the examples in CI and having some sort of acceptance test so we can automatically detect when our examples break. So this is just a start in that direction.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/13416 **Author:** [@drifkin](https://github.com/drifkin) **Created:** 12/11/2025 **Status:** ✅ Merged **Merged:** 12/12/2025 **Merged by:** [@drifkin](https://github.com/drifkin) **Base:** `main` ← **Head:** `drifkin/v1-responses-docs` --- ### 📝 Commits (3) - [`0e27dd3`](https://github.com/ollama/ollama/commit/0e27dd3a3fae7822a3d1f8e612afb051c069c97d) docs: add docs for v1/responses and rework openai compat section - [`9d38fae`](https://github.com/ollama/ollama/commit/9d38fae78e86d7d5a854924a0df6116ca2d20bc5) Update docs/api/openai-compatibility.mdx - [`b8e4153`](https://github.com/ollama/ollama/commit/b8e4153e482fb956194438ea9dde3de7826e20df) Update docs/api/openai-compatibility.mdx ### 📊 Changes **3 files changed** (+320 additions, -147 deletions) <details> <summary>View changed files</summary> 📝 `docs/api/openai-compatibility.mdx` (+137 -147) ➕ `docs/tools/extract-examples/README.md` (+46 -0) ➕ `docs/tools/extract-examples/main.go` (+137 -0) </details> ### 📄 Description (this is intended to be merged once #13351 is released) I reworked the examples to be separated by topic and to be fully runnable (i.e., they now log output instead of just suggesting how a call might be made). We now use `<CodeGroup>`s so that each example has a dropdown on the docs site for users to choose, which makes the examples a lot more digestible (since you only see approx 1/3 of the code you used to). I also added a new tool to extract code examples into files so that it's easier to actually run them and check that they work. ## Example ```shell go run docs/tools/extract-examples/main.go docs/api/openai-compatibility.mdx ``` Output: ``` Extracting code examples to: /var/folders/vq/wfm2g6k917d3ldzpjdxc8ph00000gn/T/mdx-examples-3271754368 - 01_basic.py - 01_basic.js - 01_basic.sh - 02_responses.py - 02_responses.js - 02_responses.sh - 03_vision.py - 03_vision.js - 03_vision.sh Extracted 9 file(s) to /var/folders/vq/wfm2g6k917d3ldzpjdxc8ph00000gn/T/mdx-examples-3271754368 To run examples: cd /var/folders/vq/wfm2g6k917d3ldzpjdxc8ph00000gn/T/mdx-examples-3271754368 npm install # for JS examples then run individual files with `node file.js`, `python file.py`, `bash file.sh` ``` In the future we should consider actually running the examples in CI and having some sort of acceptance test so we can automatically detect when our examples break. So this is just a start in that direction. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 17:46:38 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#24738