Skip to main content

Support for Databricks AI support with OpenAI

Project description

Databricks OpenAI Integration

The databricks-openai package provides seamless integration of Databricks AI features into OpenAI applications.

Installation

From PyPI

pip install databricks-openai

From Source

pip install git+https://git@github.com/databricks/databricks-ai-bridge.git#subdirectory=integrations/openai

Key Features

  • Vector Search: Store and query vector representations using VectorSearchRetrieverTool.

Getting Started

Use Vector Search on Databricks

# Step 1: call model with VectorSearchRetrieverTool defined
dbvs_tool = VectorSearchRetrieverTool(index_name="catalog.schema.my_index_name")
messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {
        "role": "user",
        "content": "Using the Databricks documentation, answer what is Spark?"
    }
]
first_response = client.chat.completions.create(
    model="gpt-4o",
    messages=messages,
    tools=[dbvs_tool.tool]
)

# Step 2: Execute function code – parse the model's response and handle function calls.
tool_call = first_response.choices[0].message.tool_calls[0]
args = json.loads(tool_call.function.arguments)
result = dbvs_tool.execute(query=args["query"])  # For self-managed embeddings, optionally pass in openai_client=client

# Step 3: Supply model with results – so it can incorporate them into its final response.
messages.append(first_response.choices[0].message)
messages.append({
    "role": "tool",
    "tool_call_id": tool_call.id,
    "content": json.dumps(result)
})
second_response = client.chat.completions.create(
    model="gpt-4o",
    messages=messages,
    tools=tools
)

Contribution Guide

We welcome contributions! Please see our contribution guidelines for details.

License

This project is licensed under the MIT License.

Thank you for using Databricks OpenAI!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

databricks_openai-0.12.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

databricks_openai-0.12.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file databricks_openai-0.12.0.tar.gz.

File metadata

  • Download URL: databricks_openai-0.12.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for databricks_openai-0.12.0.tar.gz
Algorithm Hash digest
SHA256 65fa0bb21fafcd0ba0ab419a7b0605e37ac875577cae3a0eb681c75a3c19f6d8
MD5 6a13bac8541ae5fc41fe1adff3e2fc60
BLAKE2b-256 470c4c1ab7578d77ceb3791a90092858a155f5ad2bb27a5ad447446d04c7d1f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for databricks_openai-0.12.0.tar.gz:

Publisher: release-databricks-openai.yml on databricks/databricks-ai-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file databricks_openai-0.12.0-py3-none-any.whl.

File metadata

File hashes

Hashes for databricks_openai-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e2661f3acc9660408083827d79a6120530cf5f847cbb4b97230e49f7b8ffe89
MD5 05eda506064dc17a66ae7bfd24dad1c6
BLAKE2b-256 ce113d206d6efba2906e65a7277305a6c65b5b2b497e9aea8824619b395153e9

See more details on using hashes here.

Provenance

The following attestation bundles were made for databricks_openai-0.12.0-py3-none-any.whl:

Publisher: release-databricks-openai.yml on databricks/databricks-ai-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page