Azure OpenAI 图像模型
Spring AI 项目集成了 Azure OpenAI 的图像生成模型。添加依赖
将spring-ai-azure-openai-spring-boot-starter 依赖项添加到您的 pom.xml 文件中:
配置 Azure OpenAI 凭证
请确保在您的application.properties 文件中设置了以下属性:
spring.ai.azure.openai.api-key: 您的 Azure OpenAI API 密钥。spring.ai.azure.openai.endpoint: 您的 Azure OpenAI 端点。
spring.ai.azure.openai.image.enabled=true 属性来启用 Azure OpenAI 图像客户端。
此外,请浏览 Azure OpenAI图像选项 (AzureOpenAiImageOptions) 了解可用的调用选项。常用选项也可以通过 spring.ai.azure.openai.image.options.* 属性进行配置。
调用 ImageClient
ImageClient 接口提供了一种与图像生成模型交互的便携方式。
ImageClient 会自动配置和注入。