Skip to content

Fix the issue#1914

Merged
jxnl merged 1 commit intomainfrom
cursor/fix-the-issue-d5d3
Nov 12, 2025
Merged

Fix the issue#1914
jxnl merged 1 commit intomainfrom
cursor/fix-the-issue-d5d3

Conversation

@jxnl
Copy link
Copy Markdown
Collaborator

@jxnl jxnl commented Nov 12, 2025

feat: add Databricks provider support

Describe your changes

This PR introduces full support for Databricks as a provider in instructor.from_provider. It enables seamless integration with Databricks models by:

  • Implementing automatic resolution of API keys and host URLs from environment variables (DATABRICKS_TOKEN, DATABRICKS_HOST, etc.) or direct arguments.
  • Normalizing Databricks base URLs to correctly point to /serving-endpoints.
  • Delegating to openai.OpenAI or openai.AsyncOpenAI for client functionality.
  • Adding dedicated unit tests to ensure correct configuration and functionality.
  • Updating the Databricks integration documentation with clear setup instructions and usage examples.

This allows users to initialize Databricks clients using instructor.from_provider("databricks/...") with minimal configuration.

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code
  • If it is a core feature, I have added thorough tests.
  • If it is a core feature, I have added documentation.

Slack Thread

Open in Cursor Open in Web


Important

Adds Databricks provider support to instructor.from_provider, including environment-based configuration, URL normalization, and OpenAI client delegation.

  • Behavior:
    • Adds Databricks support to instructor.from_provider in auto_client.py, resolving API keys and host URLs from environment variables or arguments.
    • Normalizes Databricks base URLs to /serving-endpoints.
    • Delegates client functionality to openai.OpenAI or openai.AsyncOpenAI.
    • Allows initialization of Databricks clients with instructor.from_provider("databricks/...").
  • Documentation:
    • Updates databricks.md with setup instructions and usage examples.
  • Testing:
    • Adds unit tests in test_auto_client.py for environment configuration, custom base URL, async client, and error handling for missing token or host.

This description was created by Ellipsis for 8070043. You can customize this summary. It will automatically update as commits are pushed.

Integrates Databricks models with instructor.

Co-authored-by: jason <jason@jxnl.co>
@cursor
Copy link
Copy Markdown

cursor Bot commented Nov 12, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@github-actions github-actions Bot added documentation Improvements or additions to documentation enhancement New feature or request python Pull requests that update python code labels Nov 12, 2025
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
instructor 8070043 Nov 12 2025, 12:13 AM

@jxnl jxnl marked this pull request as ready for review November 12, 2025 00:50
@jxnl jxnl merged commit 04ff85e into main Nov 12, 2025
7 of 13 checks passed
@jxnl jxnl deleted the cursor/fix-the-issue-d5d3 branch November 12, 2025 00:50
Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev Bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 8070043 in 2 minutes and 6 seconds. Click for details.
  • Reviewed 310 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. docs/integrations/databricks.md:15
  • Draft comment:
    Confirm if the command 'uv pip install instructor openai' is intentional. 'uv' looks unusual; did you mean 'pip install instructor openai'?
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 85% uv is a real, legitimate Python package installer that has gained significant traction in the Python community. It's not a typo - it's a modern alternative to pip that's faster and more reliable. The change from pip install to uv pip install appears to be an intentional modernization of the documentation. The comment assumes this is an error when it's actually a valid tool choice. This violates the rule about not making speculative comments and assumes the author made a mistake when they likely didn't. Could uv be uncommon enough that users might be confused by it? Perhaps the comment is trying to be helpful by flagging something that might confuse readers, even if uv is technically correct. While uv might be unfamiliar to some users, the comment is asking the PR author to "confirm if intentional" which violates the rule against asking authors to confirm their intention or double-check things. If the author changed it to uv, they clearly intended to do so. The comment doesn't provide value and should be deleted. This comment should be deleted. It incorrectly assumes uv is a typo when it's actually a legitimate Python package installer. The comment also violates the rule against asking authors to confirm their intention or double-check their changes.
2. instructor/auto_client.py:284
  • Draft comment:
    Consider refactoring the base URL normalization logic into a helper function to follow DRY principles.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 85% None
3. instructor/auto_client.py:267
  • Draft comment:
    The new Databricks provider branch is implemented consistently with other providers. Verify that environment variable fallbacks and error messages meet your desired configuration standards.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 85% None
4. tests/test_auto_client.py:273
  • Draft comment:
    Tests for the Databricks provider are thorough, covering environment configuration, custom base_url handling, async client, and missing token/host errors.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 85% None
5. docs/integrations/databricks.md:15
  • Draft comment:
    Typo detected: The command on line 15 begins with "uv pip install instructor openai". Verify if "uv" is intended; if not, consider removing it to use the standard "pip install" command.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 85% "uv" is a legitimate Python package manager tool (created by Astral, the same team behind ruff). The author intentionally changed the installation command to use "uv pip install" instead of just "pip install". This is not a typo - it's a deliberate choice to use the uv tool. The comment is incorrectly identifying this as a typo when it's actually an intentional change. The comment also asks to "verify" which violates the rule about not asking the PR author to confirm their intention. Could "uv" be a typo that the author accidentally introduced? Maybe they meant to type something else? However, "uv pip install" is a valid and increasingly common command pattern in Python projects. While it's theoretically possible this is a typo, "uv pip install" is a well-known command pattern for the uv package manager. The fact that the author also added "openai" to the dependencies in the same change suggests this was a deliberate update to the installation instructions. Additionally, the comment asks to "verify" which violates the rules about not asking the author to confirm intentions. This comment should be deleted. It incorrectly identifies an intentional change (using the uv package manager) as a typo, and it asks the author to "verify" their intention, which violates the review rules.
6. instructor/auto_client.py:356
  • Draft comment:
    There's a duplicate '# type: ignore[attr-defined]' comment in the import statement. Consider removing the extra comment for cleanliness.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_zgeaksQcuGte8JXk

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

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 enhancement New feature or request python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants