refactor(azure-embedding): Removed unnecessary and commented Azure embedding code (#2461)
Co-authored-by: Charles Packer <packercharles@gmail.com>
This commit is contained in:
committed by
GitHub
parent
520136c0f5
commit
6b2addf4b8
@@ -246,19 +246,6 @@ def embedding_model(config: EmbeddingConfig, user_id: Optional[uuid.UUID] = None
|
||||
model_settings.azure_api_version is not None,
|
||||
]
|
||||
)
|
||||
# from llama_index.embeddings.azure_openai import AzureOpenAIEmbedding
|
||||
|
||||
## https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#embeddings
|
||||
# model = "text-embedding-ada-002"
|
||||
# deployment = credentials.azure_embedding_deployment if credentials.azure_embedding_deployment is not None else model
|
||||
# return AzureOpenAIEmbedding(
|
||||
# model=model,
|
||||
# deployment_name=deployment,
|
||||
# api_key=credentials.azure_key,
|
||||
# azure_endpoint=credentials.azure_endpoint,
|
||||
# api_version=credentials.azure_version,
|
||||
# )
|
||||
|
||||
return AzureOpenAIEmbedding(
|
||||
api_endpoint=model_settings.azure_base_url,
|
||||
api_key=model_settings.azure_api_key,
|
||||
|
||||
@@ -119,15 +119,3 @@ def azure_openai_chat_completions_request(
|
||||
chat_completion = client.chat.completions.create(**data)
|
||||
|
||||
return ChatCompletionResponse(**chat_completion.model_dump())
|
||||
|
||||
|
||||
def azure_openai_embeddings_request(
|
||||
resource_name: str, deployment_id: str, api_version: str, api_key: str, data: dict
|
||||
) -> EmbeddingResponse:
|
||||
"""https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#embeddings"""
|
||||
|
||||
url = f"https://{resource_name}.openai.azure.com/openai/deployments/{deployment_id}/embeddings?api-version={api_version}"
|
||||
headers = {"Content-Type": "application/json", "api-key": f"{api_key}"}
|
||||
|
||||
response_json = make_post_request(url, headers, data)
|
||||
return EmbeddingResponse(**response_json)
|
||||
|
||||
Reference in New Issue
Block a user