Skip to content

[python][integrations] Add Tongyi embedding model integration#611

Merged
Sxnan merged 3 commits intoapache:mainfrom
Sxnan:tongyi-embedding-model
Apr 10, 2026
Merged

[python][integrations] Add Tongyi embedding model integration#611
Sxnan merged 3 commits intoapache:mainfrom
Sxnan:tongyi-embedding-model

Conversation

@Sxnan
Copy link
Copy Markdown
Contributor

@Sxnan Sxnan commented Apr 7, 2026

Linked issue: #610

Purpose of change

Add Tongyi (DashScope) embedding model integration for Alibaba Cloud's text embedding service.

This introduces:

  • TongyiEmbeddingModelConnection — manages the DashScope API connection with configurable API key and timeout
  • TongyiEmbeddingModelSetup — provides model configuration including text_type (query/document), dimension, and additional_kwargs
  • Resource name constants registered in both Python (ResourceName.EmbeddingModel) and Java (ResourceName.EmbeddingModel.Python)

Tests

  • 3 unit tests with mocked DashScope API
  • 2 integration tests that call the real DashScope API

API

  • Adds ResourceName.EmbeddingModel.TONGYI_EMBEDDING_MODEL_CONNECTION and ResourceName.EmbeddingModel.TONGYI_EMBEDDING_MODEL_SETUP to both Python and Java resource name registries

Documentation

  • doc-needed
  • doc-not-needed
  • doc-included

@github-actions github-actions bot added doc-included Your PR already contains the necessary documentation updates. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue. labels Apr 7, 2026
@Sxnan Sxnan requested review from wenjin272 and xintongsong April 7, 2026 08:56
@Sxnan
Copy link
Copy Markdown
Contributor Author

Sxnan commented Apr 7, 2026

@xintongsong @wenjin272 Could you review this PR?

Copy link
Copy Markdown
Collaborator

@wenjin272 wenjin272 left a comment

Choose a reason for hiding this comment

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

Hi, @Sxnan, I only have one comment.

@Sxnan
Copy link
Copy Markdown
Contributor Author

Sxnan commented Apr 9, 2026

@wenjin272 Thanks for the comment. I updated the PR. PTAL

@Sxnan Sxnan requested a review from wenjin272 April 9, 2026 04:07
default_factory=lambda: os.environ.get("DASHSCOPE_API_KEY"),
description="Your DashScope API key.",
)
request_timeout: float = Field(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It appears that request_timeout is not being used.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Sxnan
Copy link
Copy Markdown
Contributor Author

Sxnan commented Apr 9, 2026

@wenjin272 Thanks for the review. All comments have been addressed. PTAL.

@Sxnan Sxnan requested a review from wenjin272 April 10, 2026 01:46
Copy link
Copy Markdown
Collaborator

@wenjin272 wenjin272 left a comment

Choose a reason for hiding this comment

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

LGTM

@Sxnan Sxnan merged commit 834c07b into apache:main Apr 10, 2026
23 checks passed
@Sxnan Sxnan deleted the tongyi-embedding-model branch April 10, 2026 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-included Your PR already contains the necessary documentation updates. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants