Skip to content

Enable HTTP redirect following in DatabricksOpenAI clients#445

Merged
annzhang-db merged 2 commits into
mainfrom
feat/follow-redirects
Jun 24, 2026
Merged

Enable HTTP redirect following in DatabricksOpenAI clients#445
annzhang-db merged 2 commits into
mainfrom
feat/follow-redirects

Conversation

@annzhang-db

Copy link
Copy Markdown
Contributor

Summary

  • DatabricksOpenAI and AsyncDatabricksOpenAI pass a custom httpx http_client to the OpenAI SDK. The OpenAI SDK only sets follow_redirects=True on the client it builds itself; when a custom client is supplied, httpx's own default of follow_redirects=False takes over, silently disabling redirect following.
  • This restores the OpenAI SDK's intended default by building the authorized httpx clients with follow_redirects=True, applied to both the sync and async helpers for consistent behavior.
  • Exposed as a follow_redirects: bool = True parameter on both client classes so callers can opt out if needed.

Test plan

  • uv run pytest tests/unit_tests/test_clients.py (added tests assert the default is True and can be overridden to False for both sync and async helpers)

Note: the test suite could not be run locally in this environment (no network access to sync dependencies). Verified that httpx's Client/AsyncClient default follow_redirects to False and that the modules compile.

This pull request and its description were written by Isaac.

Passing a custom http_client to the OpenAI SDK bypasses its default of
follow_redirects=True, since httpx's Client defaults to False. Restore the
intended behavior by following redirects, exposed as a follow_redirects
parameter (default True) on both the sync and async clients.

Co-authored-by: Isaac
@annzhang-db annzhang-db requested a review from jennsun June 23, 2026 01:47

@jennsun jennsun left a comment

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.

lgtm!

@annzhang-db annzhang-db merged commit a95981e into main Jun 24, 2026
42 of 46 checks passed
@annzhang-db annzhang-db deleted the feat/follow-redirects branch June 24, 2026 23:12
jennsun added a commit that referenced this pull request Jun 25, 2026
## databricks-ai-bridge 0.21.0 databricks-openai 0.17.0 (2026-06-25)

### Improvements
- databricks-openai: `DatabricksOpenAI` and `AsyncDatabricksOpenAI` clients now follow HTTP redirects by default, configurable via the new `follow_redirects` parameter (#445)

### Bug Fixes
- databricks-ai-bridge: Genie now returns the full answer text aggregated from all text attachments (#432)

---

Prepares the next release following #439 (0.20.0). Bumps:
- `databricks-ai-bridge`: `0.20.0` → `0.21.0` (genie fix #432)
- `databricks-openai`: `0.16.0` → `0.17.0` (HTTP redirect support #445), with its `databricks-ai-bridge>=` floor bumped to `0.21.0`

`databricks-langchain` has no changes since 0.20.0 and is intentionally not re-released (consistent with prior releases that omitted unchanged packages).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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