Skip to content

Adding the embedding generator interface#46902

Open
aayush3011 wants to merge 4 commits into
Azure:mainfrom
aayush3011:users/akataria/EGSInterface
Open

Adding the embedding generator interface#46902
aayush3011 wants to merge 4 commits into
Azure:mainfrom
aayush3011:users/akataria/EGSInterface

Conversation

@aayush3011
Copy link
Copy Markdown
Member

@aayush3011 aayush3011 commented May 14, 2026

Description

Adds the EmbeddingProvider Protocol and EmbeddingResult dataclass to azure-cosmos (both sync and async), defining the contract the SDK will use to generate vector embeddings for GenerateEmbeddings(...) query expressions.

This PR is interface-only, no client wiring, no concrete implementation. A default Azure OpenAI implementation will ship in a future companion azure-cosmos-ai package.

EmbeddingResult is used as the return type instead of a plain List[List[float]] so the SDK can carry optional usage metadata (e.g. total_tokens) alongside the vectors for diagnostics later on without a breaking change to the Protocol.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@aayush3011 aayush3011 marked this pull request as ready for review May 14, 2026 21:02
@aayush3011 aayush3011 requested a review from a team as a code owner May 14, 2026 21:02
Copilot AI review requested due to automatic review settings May 14, 2026 21:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a public embedding-generation interface to azure-cosmos (sync + async) by introducing an EmbeddingProvider Protocol and an EmbeddingResult return type, enabling GenerateEmbeddings(...) query expressions to carry vectors plus optional usage metadata.

Changes:

  • Added EmbeddingProvider Protocols for sync and async clients.
  • Added EmbeddingResult frozen dataclass to return vectors plus optional token usage metadata.
  • Exported the new API surface via package __init__ files and documented it in the changelog.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
sdk/cosmos/azure-cosmos/azure/cosmos/aio/_embedding_provider.py Adds async EmbeddingProvider Protocol contract for aio client usage
sdk/cosmos/azure-cosmos/azure/cosmos/aio/init.py Exposes EmbeddingProvider / EmbeddingResult from azure.cosmos.aio
sdk/cosmos/azure-cosmos/azure/cosmos/_embedding_result.py Adds EmbeddingResult dataclass used as the embedding return type
sdk/cosmos/azure-cosmos/azure/cosmos/_embedding_provider.py Adds sync EmbeddingProvider Protocol contract
sdk/cosmos/azure-cosmos/azure/cosmos/init.py Exposes EmbeddingProvider / EmbeddingResult from azure.cosmos
sdk/cosmos/azure-cosmos/CHANGELOG.md Documents the new embedding interface feature

Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/_embedding_provider.py Outdated
Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/_embedding_result.py Outdated
Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/_embedding_result.py
Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/_embedding_result.py Outdated
Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/aio/_embedding_provider.py
@aayush3011 aayush3011 requested a review from Copilot May 14, 2026 21:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/_embedding_provider.py
Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/_embedding_result.py
Comment thread sdk/cosmos/azure-cosmos/azure/cosmos/aio/_embedding_provider.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants