mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-09 23:07:41 +00:00
d6cc384780
* add create/acreate vector store * add azure config * add _base_validate_azure_environment * fix base test * add get_base_create_vector_store_args * use base llm for headers responses api * add _get_base_azure_url * fix AzureOpenAIVectorStoreConfig * TestAzureOpenAIVectorStore * fix azure openai vector store * fix test comment * fix unused imports * test_validate_environment_azure_api_key_within_secret_str * test_azure_transformation.py
52 lines
1.7 KiB
Python
52 lines
1.7 KiB
Python
from typing import Any, Dict, cast, get_type_hints
|
|
|
|
from litellm.types.vector_stores import (
|
|
VectorStoreCreateOptionalRequestParams,
|
|
VectorStoreSearchOptionalRequestParams,
|
|
)
|
|
|
|
|
|
class VectorStoreRequestUtils:
|
|
"""Helper utils for constructing Vector Store search requests"""
|
|
|
|
@staticmethod
|
|
def get_requested_vector_store_search_optional_param(
|
|
params: Dict[str, Any],
|
|
) -> VectorStoreSearchOptionalRequestParams:
|
|
"""
|
|
Filter parameters to only include those defined in VectorStoreSearchOptionalRequestParams.
|
|
|
|
Args:
|
|
params: Dictionary of parameters to filter
|
|
|
|
Returns:
|
|
VectorStoreSearchOptionalRequestParams instance with only the valid parameters
|
|
"""
|
|
valid_keys = get_type_hints(VectorStoreSearchOptionalRequestParams).keys()
|
|
filtered_params = {
|
|
k: v for k, v in params.items() if k in valid_keys and v is not None
|
|
}
|
|
|
|
return cast(VectorStoreSearchOptionalRequestParams, filtered_params)
|
|
|
|
@staticmethod
|
|
def get_requested_vector_store_create_optional_param(
|
|
params: Dict[str, Any],
|
|
) -> VectorStoreCreateOptionalRequestParams:
|
|
"""
|
|
Filter parameters to only include those defined in VectorStoreCreateOptionalRequestParams.
|
|
|
|
Args:
|
|
params: Dictionary of parameters to filter
|
|
|
|
Returns:
|
|
VectorStoreCreateOptionalRequestParams instance with only the valid parameters
|
|
"""
|
|
valid_keys = get_type_hints(VectorStoreCreateOptionalRequestParams).keys()
|
|
filtered_params = {
|
|
k: v for k, v in params.items() if k in valid_keys and v is not None
|
|
}
|
|
|
|
return cast(VectorStoreCreateOptionalRequestParams, filtered_params)
|
|
|