Skip to content

Support separate Conversations API base URL#431

Open
annzhang-db wants to merge 1 commit into
databricks:mainfrom
annzhang-db:codex/conversations-base-url
Open

Support separate Conversations API base URL#431
annzhang-db wants to merge 1 commit into
databricks:mainfrom
annzhang-db:codex/conversations-base-url

Conversation

@annzhang-db
Copy link
Copy Markdown
Contributor

@annzhang-db annzhang-db commented Jun 5, 2026

Summary

  • Add conversations_base_url to DatabricksOpenAI and AsyncDatabricksOpenAI
  • Route client.conversations through a cached internal OpenAI client, defaulting to {workspace_url}/api/2.1/unity-catalog
  • Keep client.responses on the primary OpenAI-compatible base URL, such as AI Gateway, and allow custom Conversations API overrides
  • Document the split-routing use case and add sync/async unit coverage

How do you know it works?

  • Added unit tests for default and overridden Conversations API routing on both sync and async clients. These cover the default Unity Catalog Conversations API base URL and explicit conversations_base_url overrides while Responses API calls stay on the main client base URL.
  • Ran PYTHONPATH=/home/ann.zhang/databricks-ai-bridge/integrations/openai/src:/home/ann.zhang/databricks-ai-bridge/src python -m pytest tests/unit_tests/test_clients.py -k ConversationsBaseUrl from integrations/openai: 4 passed.
  • Ran python -m py_compile integrations/openai/src/databricks_openai/utils/clients.py integrations/openai/tests/unit_tests/test_clients.py.
  • Ran git diff --check.

Note: I could not run the full test_clients.py in the local base environment because pytest-asyncio is not installed there, and uv could not fetch dependencies due a PyPI DNS resolution failure. ruff was also not installed in the local base environment.

@annzhang-db annzhang-db force-pushed the codex/conversations-base-url branch 2 times, most recently from 352be3d to 97120ff Compare June 5, 2026 01:12
@property
def conversations(self) -> Conversations:
if not hasattr(self, "_databricks_conversations_client"):
self._databricks_conversations_client = OpenAI(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should use DatabricksOpenAI here right so workspace client authorization flows through?

@annzhang-db annzhang-db force-pushed the codex/conversations-base-url branch from 97120ff to 8e186a9 Compare June 5, 2026 01:43
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