Skip to content

VectorSearchRetrieverTool Openai integration#39

Merged
leonbi-db merged 15 commits intodatabricks:mainfrom
leonbi100:openai-integration
Jan 14, 2025
Merged

VectorSearchRetrieverTool Openai integration#39
leonbi-db merged 15 commits intodatabricks:mainfrom
leonbi100:openai-integration

Conversation

@leonbi100
Copy link
Copy Markdown
Contributor

@leonbi100 leonbi100 commented Jan 3, 2025

What does this PR do?

This PR introduces the databricks-openai python package with the VectorSearchRetrieverTool. The VectorSearchRetrieverTool allows for easy integration between OpenAI chat completions tool calling and Databricks VectorSearch. This tool supports the 3 types of VectorSearch Indexes. See testing below for usage details.

Delta Sync Index with Databricks managed embeddings:

image image

Delta Sync Index with self managed embeddings:

image image

Direct Access Index:

image image

@leonbi100 leonbi100 changed the title Openai integration VectorSearchRetrieverTool Openai integration Jan 9, 2025
@leonbi100 leonbi100 marked this pull request as ready for review January 9, 2025 20:40
Copy link
Copy Markdown
Contributor

@annzhang-db annzhang-db left a comment

Choose a reason for hiding this comment

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

lgtm! just left a couple comments

@@ -0,0 +1,6 @@
from databricks_openai.vector_search_retriever_tool import VectorSearchRetrieverTool

# Expose all integrations to users under databricks-langchain
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.

I'm assuming this is supposed to be databricks-openai?

None,
description="The name of the text column to use for the embeddings. "
"Required for direct-access index or delta-sync index with "
"self-managed embeddings. Used for direct access indexes or "
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.

nit: do we need the description to be duplicated (required for ... used for ...)?

) -> List[Dict[str, Any]]:
"""
Execute the VectorSearchIndex tool calls from the ChatCompletions response that correspond to the
self.tool VectorSearchRetrieverToolInput and attach the retrieved documents into toll call messages.
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.

nit: typo

Suggested change
self.tool VectorSearchRetrieverToolInput and attach the retrieved documents into toll call messages.
self.tool VectorSearchRetrieverToolInput and attach the retrieved documents into tool call messages.

embedding_model_name=self_managed_embeddings_test.embedding_model_name,
openai_client=self_managed_embeddings_test.open_ai_client,
)
assert response is not None
Copy link
Copy Markdown
Contributor

@annzhang-db annzhang-db Jan 10, 2025

Choose a reason for hiding this comment

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

Could we add a little more validation on the response?

@leonbi-db leonbi-db merged commit d19fe9e into databricks:main Jan 14, 2025
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.

3 participants