Skip to content

docs: OpenAI responses endpoint#9539

Merged
mendonk merged 33 commits into
docs-1.6from
docs-openai-api-endpoint
Sep 5, 2025
Merged

docs: OpenAI responses endpoint#9539
mendonk merged 33 commits into
docs-1.6from
docs-openai-api-endpoint

Conversation

@mendonk
Copy link
Copy Markdown
Collaborator

@mendonk mendonk commented Aug 26, 2025

Preview build
Add documentation for the OpenAI compatible endpoint in #9069
Include headers, request and response params, example requests, and example streaming requests.
Include the features for:

  • passing global variables in headers
  • retrieving tool call outputs
  • using previous_response_id for continuous conversation

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 26, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs-openai-api-endpoint

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Aug 26, 2025
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Aug 26, 2025
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Aug 26, 2025
codeflash-ai Bot added a commit that referenced this pull request Aug 26, 2025
…ocs-openai-api-endpoint`)

The optimization removes the default empty list `[]` from `server_config.get("args", [])` and changes it to `server_config.get("args")`. This small change eliminates unnecessary list object creation when the "args" key is missing from server configurations.

**Key optimization:** Instead of creating a new empty list every time a server config lacks an "args" key, the code now gets `None` and relies on the existing `if args and args[-1] == sse_url:` check to handle both missing keys and empty lists correctly.

**Why this is faster:** In Python, creating list objects has overhead - even empty lists require memory allocation and object initialization. The line profiler shows this optimization saves ~140 microseconds (4.7% improvement) on the `args = server_config.get("args")` line specifically. When this line executes 6,574 times in the profiled run, these small savings compound to a meaningful 20% overall speedup.

**Test case performance:** This optimization is particularly effective for configurations with many servers that lack "args" keys, as shown in test cases like `test_large_number_of_servers_some_with_empty_args()` where half the servers have missing args. The more servers without args keys, the more list creations are avoided.

The behavior remains identical since `None and args[-1] == sse_url` still evaluates to `False` just like `[] and args[-1] == sse_url` would.
@codeflash-ai
Copy link
Copy Markdown
Contributor

codeflash-ai Bot commented Aug 26, 2025

⚡️ Codeflash found optimizations for this PR

📄 21% (0.21x) speedup for config_contains_sse_url in langflow/api/v1/mcp_projects.py

⏱️ Runtime : 741 microseconds 613 microseconds (best of 51 runs)

I created a new dependent PR with the suggested changes. Please review:

If you approve, it will be merged into this PR (branch docs-openai-api-endpoint).

@mendonk mendonk changed the title docs: OpenAI reponses endpoint docs: OpenAI responses endpoint Aug 26, 2025
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Aug 26, 2025
Comment thread docs/docs/API-Reference/api-openai-responses.mdx Outdated
codeflash-ai Bot added a commit that referenced this pull request Aug 26, 2025
…i-endpoint`)

The optimization replaces `pkg.split(".", 1)[0]` with `pkg.partition('.')[0]`. This change delivers a **13% speedup** because:

**Key Optimization:**
- `str.partition()` is specifically designed for splitting a string at the first occurrence of a separator, returning a 3-tuple `(before, separator, after)`
- `str.split(".", 1)` creates an intermediate list object before indexing, while `partition()` directly returns a tuple
- Tuple access is faster than list access in CPython, and no intermediate list allocation occurs

**Performance Impact:**
- Line profiler shows per-hit time improved from 681.5ns to 613.3ns (10% per-call improvement)
- The optimization is most effective for high-frequency calls, as evidenced by the 1060 hits in the profiler

**Test Case Performance:**
- Works equally well across all test scenarios - basic package names, edge cases with dots/spaces, and large-scale tests with long strings
- Maintains identical behavior for all edge cases (empty strings, leading dots, unicode characters)
- The optimization benefits any workload that processes many package names, regardless of string length or complexity

This is a classic example of choosing the right string method for the task - `partition()` is purpose-built for "split at first occurrence" operations and avoids the overhead of general-purpose `split()`.
@codeflash-ai
Copy link
Copy Markdown
Contributor

codeflash-ai Bot commented Aug 26, 2025

⚡️ Codeflash found optimizations for this PR

📄 13% (0.13x) speedup for _top_level in langflow/custom/dependency_analyzer.py

⏱️ Runtime : 298 microseconds 263 microseconds (best of 137 runs)

I created a new dependent PR with the suggested changes. Please review:

If you approve, it will be merged into this PR (branch docs-openai-api-endpoint).

codeflash-ai Bot added a commit that referenced this pull request Aug 26, 2025
…s-openai-api-endpoint`)

The optimization applies **caching** to the `get_settings_service()` function using `@lru_cache(maxsize=1)`. This addresses the primary performance bottleneck identified in the profiling data.

**Key Change:**
- Added `@lru_cache(maxsize=1)` decorator to `get_settings_service()` in `deps.py`
- Added `from functools import lru_cache` import

**Why This Works:**
The line profiler shows `get_settings_service()` consuming 99.9% of its execution time (52.4ms out of 52.5ms total) in the `get_service()` call, which involves expensive service initialization and factory registration. This function is called repeatedly throughout the encryption process - once per `encrypt_auth_settings()` call and then again for each encrypt/decrypt operation.

With caching, the expensive initialization only happens on the first call. Subsequent calls return the cached `SettingsService` instance in O(1) time, eliminating the redundant factory lookups and service manager operations.

**Performance Impact:**
- `get_settings_service()` time drops from ~6.7ms to ~0.89ms per call (87% reduction)
- Overall function runtime improves from 3.61ms to 2.04ms (77% speedup)
- The optimization is most effective for workloads with multiple encryption operations, as shown in the large-scale test cases with 900+ fields

**When This Optimization Helps:**
This is particularly beneficial for scenarios involving multiple authentication settings encryption in the same process, such as batch operations or applications with frequent auth setting updates, where the same settings service would otherwise be repeatedly initialized.
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 4, 2025
@mendonk mendonk requested a review from aimurphy September 4, 2025 15:56
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 4, 2025
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Collaborator

@aimurphy aimurphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much easier to follow now. Just some touchups and consistency edits.
Approving to unblock you, but please see my suggestions and comments.

Comment thread docs/docs/API-Reference/api-openai-responses.mdx Outdated
Comment thread docs/docs/API-Reference/api-openai-responses.mdx Outdated
Comment thread docs/docs/API-Reference/api-openai-responses.mdx Outdated
Comment thread docs/docs/API-Reference/api-openai-responses.mdx Outdated
Comment thread docs/docs/API-Reference/api-openai-responses.mdx Outdated
Comment thread docs/docs/API-Reference/api-openai-responses.mdx Outdated
Comment thread docs/docs/API-Reference/api-openai-responses.mdx Outdated
Comment thread docs/docs/API-Reference/api-openai-responses.mdx Outdated
Comment thread docs/docs/API-Reference/api-openai-responses.mdx Outdated
Comment thread docs/docs/API-Reference/api-openai-responses.mdx Outdated
@github-actions github-actions Bot added the lgtm This PR has been approved by a maintainer label Sep 4, 2025
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 4, 2025
@github-actions

This comment has been minimized.

@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 5, 2025
@github-actions github-actions Bot added documentation Improvements or additions to documentation and removed documentation Improvements or additions to documentation labels Sep 5, 2025
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Sep 5, 2025

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 5, 2025

Build successful! ✅
Deploying docs draft.
Deploy successful! View draft

@mendonk mendonk merged commit 2b103fb into docs-1.6 Sep 5, 2025
16 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Sep 5, 2025

Build successful! ✅
Deploying docs draft.
Deploy successful! View draft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants