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

feat: adds model selection to Azure OpenAI Embeddings component #3882

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/docs/Components/components-embedding-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ This component generates embeddings using Azure OpenAI models.

| Name | Type | Description |
|------|------|-------------|
| Model | String | Name of the model to use (default: `text-embedding-3-small`) |
| Azure Endpoint | String | Your Azure endpoint, including the resource. Example: `https://example-resource.azure.openai.com/` |
| Deployment Name | String | The name of the deployment |
| API Version | String | The API version to use, options include various dates |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from langchain_openai import AzureOpenAIEmbeddings

from langflow.base.models.model import LCModelComponent
from langflow.base.models.openai_constants import OPENAI_EMBEDDING_MODEL_NAMES
from langflow.field_typing import Embeddings
from langflow.io import DropdownInput, IntInput, MessageTextInput, Output, SecretStrInput

Expand All @@ -22,6 +23,13 @@ class AzureOpenAIEmbeddingsComponent(LCModelComponent):
]

inputs = [
DropdownInput(
name="model",
display_name="Model",
advanced=False,
options=OPENAI_EMBEDDING_MODEL_NAMES,
value=OPENAI_EMBEDDING_MODEL_NAMES[0],
),
MessageTextInput(
name="azure_endpoint",
display_name="Azure Endpoint",
Expand Down Expand Up @@ -60,6 +68,7 @@ class AzureOpenAIEmbeddingsComponent(LCModelComponent):
def build_embeddings(self) -> Embeddings:
try:
embeddings = AzureOpenAIEmbeddings(
model=self.model,
azure_endpoint=self.azure_endpoint,
azure_deployment=self.azure_deployment,
api_version=self.api_version,
Expand Down
Loading