Skip to content

azure_openai_drivers_config

AzureOpenAiDriversConfig

Bases: DriversConfig

Azure OpenAI Drivers Configuration.

Attributes:

Name Type Description
azure_endpoint str

The endpoint for the Azure OpenAI instance.

azure_ad_token Optional[str]

An optional Azure Active Directory token.

azure_ad_token_provider Optional[Callable[[], str]]

An optional Azure Active Directory token provider.

api_key Optional[str]

An optional Azure API key.

prompt_driver AzureOpenAiChatPromptDriver

An Azure OpenAI Chat Prompt Driver.

image_generation_driver AzureOpenAiImageGenerationDriver

An Azure OpenAI Image Generation Driver.

image_query_driver AzureOpenAiImageQueryDriver

An Azure OpenAI Vision Image Query Driver.

embedding_driver AzureOpenAiEmbeddingDriver

An Azure OpenAI Embedding Driver.

vector_store_driver LocalVectorStoreDriver

A Local Vector Store Driver.

Source code in griptape/configs/drivers/azure_openai_drivers_config.py
@define
class AzureOpenAiDriversConfig(DriversConfig):
    """Azure OpenAI Drivers Configuration.

    Attributes:
        azure_endpoint: The endpoint for the Azure OpenAI instance.
        azure_ad_token: An optional Azure Active Directory token.
        azure_ad_token_provider: An optional Azure Active Directory token provider.
        api_key: An optional Azure API key.
        prompt_driver: An Azure OpenAI Chat Prompt Driver.
        image_generation_driver: An Azure OpenAI Image Generation Driver.
        image_query_driver: An Azure OpenAI Vision Image Query Driver.
        embedding_driver: An Azure OpenAI Embedding Driver.
        vector_store_driver: A Local Vector Store Driver.
    """

    azure_endpoint: str = field(kw_only=True, metadata={"serializable": True})
    azure_ad_token: Optional[str] = field(kw_only=True, default=None, metadata={"serializable": False})
    azure_ad_token_provider: Optional[Callable[[], str]] = field(
        kw_only=True,
        default=None,
        metadata={"serializable": False},
    )
    api_key: Optional[str] = field(kw_only=True, default=None, metadata={"serializable": False})

    @lazy_property()
    def prompt_driver(self) -> AzureOpenAiChatPromptDriver:
        return AzureOpenAiChatPromptDriver(
            model="gpt-4o",
            azure_endpoint=self.azure_endpoint,
            api_key=self.api_key,
            azure_ad_token=self.azure_ad_token,
            azure_ad_token_provider=self.azure_ad_token_provider,
        )

    @lazy_property()
    def embedding_driver(self) -> AzureOpenAiEmbeddingDriver:
        return AzureOpenAiEmbeddingDriver(
            model="text-embedding-3-small",
            azure_endpoint=self.azure_endpoint,
            api_key=self.api_key,
            azure_ad_token=self.azure_ad_token,
            azure_ad_token_provider=self.azure_ad_token_provider,
        )

    @lazy_property()
    def image_generation_driver(self) -> AzureOpenAiImageGenerationDriver:
        return AzureOpenAiImageGenerationDriver(
            model="dall-e-2",
            azure_endpoint=self.azure_endpoint,
            api_key=self.api_key,
            azure_ad_token=self.azure_ad_token,
            azure_ad_token_provider=self.azure_ad_token_provider,
            image_size="512x512",
        )

    @lazy_property()
    def image_query_driver(self) -> AzureOpenAiImageQueryDriver:
        return AzureOpenAiImageQueryDriver(
            model="gpt-4o",
            azure_endpoint=self.azure_endpoint,
            api_key=self.api_key,
            azure_ad_token=self.azure_ad_token,
            azure_ad_token_provider=self.azure_ad_token_provider,
        )

    @lazy_property()
    def vector_store_driver(self) -> LocalVectorStoreDriver:
        return LocalVectorStoreDriver(
            embedding_driver=AzureOpenAiEmbeddingDriver(
                model="text-embedding-3-small",
                azure_endpoint=self.azure_endpoint,
                api_key=self.api_key,
                azure_ad_token=self.azure_ad_token,
                azure_ad_token_provider=self.azure_ad_token_provider,
            )
        )

    @lazy_property()
    def text_to_speech_driver(self) -> AzureOpenAiTextToSpeechDriver:
        return AzureOpenAiTextToSpeechDriver(
            model="tts",
            azure_endpoint=self.azure_endpoint,
            api_key=self.api_key,
            azure_ad_token=self.azure_ad_token,
            azure_ad_token_provider=self.azure_ad_token_provider,
        )

api_key: Optional[str] = field(kw_only=True, default=None, metadata={'serializable': False}) class-attribute instance-attribute

azure_ad_token: Optional[str] = field(kw_only=True, default=None, metadata={'serializable': False}) class-attribute instance-attribute

azure_ad_token_provider: Optional[Callable[[], str]] = field(kw_only=True, default=None, metadata={'serializable': False}) class-attribute instance-attribute

azure_endpoint: str = field(kw_only=True, metadata={'serializable': True}) class-attribute instance-attribute

embedding_driver()

Source code in griptape/configs/drivers/azure_openai_drivers_config.py
@lazy_property()
def embedding_driver(self) -> AzureOpenAiEmbeddingDriver:
    return AzureOpenAiEmbeddingDriver(
        model="text-embedding-3-small",
        azure_endpoint=self.azure_endpoint,
        api_key=self.api_key,
        azure_ad_token=self.azure_ad_token,
        azure_ad_token_provider=self.azure_ad_token_provider,
    )

image_generation_driver()

Source code in griptape/configs/drivers/azure_openai_drivers_config.py
@lazy_property()
def image_generation_driver(self) -> AzureOpenAiImageGenerationDriver:
    return AzureOpenAiImageGenerationDriver(
        model="dall-e-2",
        azure_endpoint=self.azure_endpoint,
        api_key=self.api_key,
        azure_ad_token=self.azure_ad_token,
        azure_ad_token_provider=self.azure_ad_token_provider,
        image_size="512x512",
    )

image_query_driver()

Source code in griptape/configs/drivers/azure_openai_drivers_config.py
@lazy_property()
def image_query_driver(self) -> AzureOpenAiImageQueryDriver:
    return AzureOpenAiImageQueryDriver(
        model="gpt-4o",
        azure_endpoint=self.azure_endpoint,
        api_key=self.api_key,
        azure_ad_token=self.azure_ad_token,
        azure_ad_token_provider=self.azure_ad_token_provider,
    )

prompt_driver()

Source code in griptape/configs/drivers/azure_openai_drivers_config.py
@lazy_property()
def prompt_driver(self) -> AzureOpenAiChatPromptDriver:
    return AzureOpenAiChatPromptDriver(
        model="gpt-4o",
        azure_endpoint=self.azure_endpoint,
        api_key=self.api_key,
        azure_ad_token=self.azure_ad_token,
        azure_ad_token_provider=self.azure_ad_token_provider,
    )

text_to_speech_driver()

Source code in griptape/configs/drivers/azure_openai_drivers_config.py
@lazy_property()
def text_to_speech_driver(self) -> AzureOpenAiTextToSpeechDriver:
    return AzureOpenAiTextToSpeechDriver(
        model="tts",
        azure_endpoint=self.azure_endpoint,
        api_key=self.api_key,
        azure_ad_token=self.azure_ad_token,
        azure_ad_token_provider=self.azure_ad_token_provider,
    )

vector_store_driver()

Source code in griptape/configs/drivers/azure_openai_drivers_config.py
@lazy_property()
def vector_store_driver(self) -> LocalVectorStoreDriver:
    return LocalVectorStoreDriver(
        embedding_driver=AzureOpenAiEmbeddingDriver(
            model="text-embedding-3-small",
            azure_endpoint=self.azure_endpoint,
            api_key=self.api_key,
            azure_ad_token=self.azure_ad_token,
            azure_ad_token_provider=self.azure_ad_token_provider,
        )
    )