Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VectorSearchRetrieverTool Openai integration #39

Merged
merged 15 commits into from
Jan 14, 2025

Conversation

leonbi100
Copy link
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

@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

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 "

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.

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

@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
5 checks passed
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