跳到主要内容
版本:1.1.5

Spring Boot 配置速查

Spring AI 1.1.5 全部配置节点索引,按功能域分组。

1. 核心配置

重试

属性类型默认值说明
spring.ai.retry.max-attemptsint10最大重试次数
spring.ai.retry.on-client-errorsbooleanfalse对 4xx 客户端错误进行重试
spring.ai.retry.exclude-on-http-codesList<Integer>[]不触发重试的 HTTP 状态码
spring.ai.retry.on-http-codesList<Integer>[]触发重试的 HTTP 状态码
spring.ai.retry.backoff.initial-intervalDuration2s初始退避间隔
spring.ai.retry.backoff.multiplierint5退避乘数
spring.ai.retry.backoff.max-intervalDuration3m最大退避间隔

工具调用

属性类型默认值说明
spring.ai.tools.throw-exception-on-errorbooleanfalse工具调用异常是否直接抛出
spring.ai.tools.observations.include-contentbooleanfalse可观测性是否包含工具调用内容

2. 模型厂商

OpenAI

连接配置:

属性默认值说明
spring.ai.openai.api-keyAPI 密钥
spring.ai.openai.base-urlhttps://api.openai.comAPI 基础 URL
spring.ai.openai.project-id项目 ID
spring.ai.openai.organization-id组织 ID

Chat:

属性默认值说明
spring.ai.openai.chat.completions-path/v1/chat/completions补全端点路径
spring.ai.openai.chat.options.modelgpt-4o-mini模型名称
spring.ai.openai.chat.options.temperature0.7温度

Embedding:

属性默认值说明
spring.ai.openai.embedding.embeddings-path/v1/embeddings嵌入端点路径
spring.ai.openai.embedding.metadata-modeEMBED元数据模式
spring.ai.openai.embedding.options.modeltext-embedding-ada-002嵌入模型

Image:

属性默认值说明
spring.ai.openai.image.images-pathv1/images/generations图像端点路径
spring.ai.openai.image.options.modeldall-e-3图像模型

Audio Transcription:

属性默认值说明
spring.ai.openai.audio.transcription.options.modelwhisper-1转录模型

Audio Speech:

属性默认值说明
spring.ai.openai.audio.speech.options.modeltts-1TTS 模型
spring.ai.openai.audio.speech.options.voicealloy语音选项

Moderation:

属性默认值说明
spring.ai.openai.moderation.options.modelomni-moderation-latest审核模型

Azure OpenAI

属性默认值说明
spring.ai.azure.openai.api-keyAPI 密钥
spring.ai.azure.openai.endpointAzure 端点 URL
spring.ai.azure.openai.custom-headers{}自定义 HTTP 头
spring.ai.azure.openai.chat.options.deployment-namegpt-4o聊天部署名
spring.ai.azure.openai.chat.options.temperature0.7温度
spring.ai.azure.openai.embedding.options.deployment-nametext-embedding-ada-002嵌入部署名
spring.ai.azure.openai.embedding.metadata-modeEMBED元数据模式
spring.ai.azure.openai.image.options.deployment-name图像部署名
spring.ai.azure.openai.audio.transcription.options.deployment-name转录部署名

Ollama

属性默认值说明
spring.ai.ollama.base-urlhttp://localhost:11434Ollama 服务地址
spring.ai.ollama.chat.options.modelmistral聊天模型
spring.ai.ollama.embedding.options.modelmxbai-embed-large嵌入模型
spring.ai.ollama.init.pull-model-strategyNEVER启动时拉取模型策略
spring.ai.ollama.init.timeout5m拉取超时
spring.ai.ollama.init.max-retries0拉取重试次数
spring.ai.ollama.init.chat.includetrue初始化聊天模型
spring.ai.ollama.init.chat.additional-models[]额外聊天模型
spring.ai.ollama.init.embedding.includetrue初始化嵌入模型
spring.ai.ollama.init.embedding.additional-models[]额外嵌入模型

Anthropic

属性默认值说明
spring.ai.anthropic.api-keyAPI 密钥
spring.ai.anthropic.base-urlAPI 基础 URL
spring.ai.anthropic.versionAPI 版本
spring.ai.anthropic.beta-version测试版功能版本
spring.ai.anthropic.chat.options.modelclaude-haiku-4-5模型名称
spring.ai.anthropic.chat.options.max-tokens500最大输出 token

DeepSeek

属性默认值说明
spring.ai.deepseek.api-keyAPI 密钥
spring.ai.deepseek.base-urlhttps://api.deepseek.comAPI 基础 URL
spring.ai.deepseek.chat.completions-path/chat/completions补全路径
spring.ai.deepseek.chat.options.modeldeepseek-chat模型名称
spring.ai.deepseek.chat.options.temperature1.0温度

Mistral AI

属性默认值说明
spring.ai.mistralai.api-keyAPI 密钥
spring.ai.mistralai.base-urlhttps://api.mistral.aiAPI 基础 URL
spring.ai.mistralai.chat.options.modelmistral-small聊天模型
spring.ai.mistralai.chat.options.temperature0.7温度
spring.ai.mistralai.embedding.metadata-modeEMBED元数据模式
spring.ai.mistralai.moderation.options.modelmistral-moderation审核模型

Vertex AI Gemini

属性默认值说明
spring.ai.vertex.ai.gemini.project-idGCP 项目 ID
spring.ai.vertex.ai.gemini.location区域
spring.ai.vertex.ai.gemini.credentials-uri凭据文件路径
spring.ai.vertex.ai.gemini.api-endpointAPI 端点
spring.ai.vertex.ai.gemini.scopes[]OAuth 作用域
spring.ai.vertex.ai.gemini.transportGRPC传输方式(GRPC / REST)
spring.ai.vertex.ai.gemini.chat.options.modelgemini-2.0-flash模型名称
spring.ai.vertex.ai.gemini.chat.options.temperature0.7温度

Vertex AI Embedding

属性默认值说明
spring.ai.vertex.ai.embedding.project-idGCP 项目 ID
spring.ai.vertex.ai.embedding.location区域
spring.ai.vertex.ai.embedding.credentials-uri凭据文件路径
spring.ai.vertex.ai.embedding.text.options.model文本嵌入模型
spring.ai.vertex.ai.embedding.multimodal.options.model多模态嵌入模型

Amazon Bedrock

属性默认值说明
spring.ai.bedrock.aws.regionus-east-1AWS 区域
spring.ai.bedrock.aws.access-keyAWS 访问密钥
spring.ai.bedrock.aws.secret-keyAWS 秘密密钥
spring.ai.bedrock.aws.session-tokenAWS 会话令牌
spring.ai.bedrock.aws.timeout5m超时
spring.ai.bedrock.converse.chat.enabledtrue是否启用 Bedrock Converse Chat
spring.ai.bedrock.converse.chat.options.temperature0.7温度
spring.ai.bedrock.converse.chat.options.max-tokens300最大 token
spring.ai.bedrock.cohere.embedding.enabledtrue是否启用 Cohere Embedding
spring.ai.bedrock.cohere.embedding.modelcohere.embed-multilingual-v3Cohere 嵌入模型
spring.ai.bedrock.titan.embedding.modelamazon.titan-embed-image-v1Titan 嵌入模型

OCI GenAI

属性默认值说明
spring.ai.oci.genai.authentication-typeFILE认证类型
spring.ai.oci.genai.profileDEFAULTOCI 配置文件
spring.ai.oci.genai.file~/.oci/config配置文件路径
spring.ai.oci.genai.tenant-idOCI 租户 ID
spring.ai.oci.genai.user-idOCI 用户 ID
spring.ai.oci.genai.fingerprintAPI 密钥指纹
spring.ai.oci.genai.private-key私钥
spring.ai.oci.genai.regionus-chicago-1OCI 区域
spring.ai.oci.genai.cohere.chat.options.model聊天模型
spring.ai.oci.genai.embedding.model嵌入模型

Stability AI

属性默认值说明
spring.ai.stabilityai.api-keyAPI 密钥
spring.ai.stabilityai.base-urlAPI 基础 URL
spring.ai.stabilityai.image.options.modelstable-diffusion-v1-6图像模型

Zhipu AI

属性默认值说明
spring.ai.zhipuai.api-keyAPI 密钥
spring.ai.zhipuai.base-urlhttps://open.bigmodel.cn/api/paasAPI 基础 URL
spring.ai.zhipuai.chat.options.modelglm-4-air聊天模型
spring.ai.zhipuai.chat.options.temperature0.7温度
spring.ai.zhipuai.embedding.options.modelembedding-2嵌入模型
spring.ai.zhipuai.embedding.metadata-modeEMBED元数据模式
spring.ai.zhipuai.image.options.model图像模型

MiniMax

属性默认值说明
spring.ai.minimax.api-keyAPI 密钥
spring.ai.minimax.base-urlhttps://api.minimax.chatAPI 基础 URL
spring.ai.minimax.chat.options.modelabab5.5-chat聊天模型
spring.ai.minimax.chat.options.temperature0.7温度
spring.ai.minimax.embedding.options.modelembo-01嵌入模型
spring.ai.minimax.embedding.metadata-modeEMBED元数据模式

HuggingFace

属性默认值说明
spring.ai.huggingface.chat.api-key推理 API 密钥
spring.ai.huggingface.chat.url推理端点 URL

ONNX Transformers

属性默认值说明
spring.ai.embedding.transformer.metadata-modeNONE元数据模式
spring.ai.embedding.transformer.tokenizer.uriTokenizer URI
spring.ai.embedding.transformer.tokenizer.options{}Tokenizer 选项
spring.ai.embedding.transformer.cache.enabledtrue启用资源缓存
spring.ai.embedding.transformer.cache.directory缓存目录
spring.ai.embedding.transformer.onnx.model-urisentence-transformers/all-MiniLM-L6-v2ONNX 模型 URI
spring.ai.embedding.transformer.onnx.model-output-namelast_hidden_state模型输出名
spring.ai.embedding.transformer.onnx.gpu-device-id-1GPU 设备 ID(>=0 启用 GPU)

ElevenLabs(1.1.0 新增)

属性默认值说明
spring.ai.elevenlabs.api-keyAPI 密钥
spring.ai.elevenlabs.base-urlAPI 基础 URL
spring.ai.elevenlabs.audio.speech.options.modeleleven_multilingual_v2TTS 模型
spring.ai.elevenlabs.audio.speech.options.voice语音 ID
spring.ai.elevenlabs.audio.speech.options.speed1.0语速
spring.ai.elevenlabs.audio.speech.options.response-formatmp3_44100_128输出格式

OpenAI SDK(1.1.1 新增)

基于 OpenAI 官方 Java SDK(openai-java)的集成,与原有 spring-ai-openai 模块独立。

属性默认值说明
spring.ai.openai-sdk.api-keyAPI 密钥
spring.ai.openai-sdk.base-urlAPI 基础 URL
spring.ai.openai-sdk.project-id项目 ID
spring.ai.openai-sdk.organization-id组织 ID
spring.ai.openai-sdk.chat.options.modelgpt-4o-mini聊天模型
spring.ai.openai-sdk.chat.options.temperature0.7温度
spring.ai.openai-sdk.embedding.options.modeltext-embedding-ada-002嵌入模型
spring.ai.openai-sdk.image.options.modeldall-e-3图像模型

PostgresML

属性默认值说明
spring.ai.postgresml.embedding.create-extensionfalse创建扩展
spring.ai.postgresml.embedding.options.transformerTransformer 模型

3. 可观测性

属性默认值说明
spring.ai.chat.observations.log-completionfalse日志记录模型回复
spring.ai.chat.observations.log-promptfalse日志记录提示词
spring.ai.chat.observations.include-error-loggingfalse包含错误日志
spring.ai.chat.client.enabledtrue启用 ChatClient 构建器
spring.ai.chat.client.observations.log-promptfalseChatClient 观测记录提示词
spring.ai.image.observations.log-promptfalse图像观测记录提示词
spring.ai.tools.observations.include-contentfalse工具观测包含内容
spring.ai.vectorstore.observations.log-query-responsefalse记录搜索响应

4. 聊天记忆

JDBC

属性默认值说明
spring.ai.chat.memory.repository.jdbc.initialize-schemaEMBEDDED启动时建表
spring.ai.chat.memory.repository.jdbc.schemaDDL 脚本位置
spring.ai.chat.memory.repository.jdbc.platform初始化脚本平台

Cassandra

属性默认值说明
spring.ai.chat.memory.repository.cassandra.keyspace键空间
spring.ai.chat.memory.repository.cassandra.table表名
spring.ai.chat.memory.repository.cassandra.initialize-schematrue初始化 Schema
spring.ai.chat.memory.repository.cassandra.time-to-liveTTL

Neo4j

属性默认值说明
spring.ai.chat.memory.repository.neo4j.session-label会话标签
spring.ai.chat.memory.repository.neo4j.message-label消息标签
spring.ai.chat.memory.repository.neo4j.media-label媒体标签

5. MCP

服务端

属性默认值说明
spring.ai.mcp.server.enabledtrue启用 MCP 服务器
spring.ai.mcp.server.stdiofalse启用 STDIO 传输
spring.ai.mcp.server.namemcp-server服务器名称
spring.ai.mcp.server.version1.0.0服务器版本
spring.ai.mcp.server.instructions服务器说明
spring.ai.mcp.server.typeSYNC服务器类型(SYNC / ASYNC)
spring.ai.mcp.server.request-timeout20s请求超时
spring.ai.mcp.server.base-url基础 URL
spring.ai.mcp.server.sse-endpoint/sseSSE 端点
spring.ai.mcp.server.sse-message-endpoint/mcp/messageSSE 消息端点
spring.ai.mcp.server.resource-change-notificationtrue资源变更通知
spring.ai.mcp.server.tool-change-notificationtrue工具变更通知
spring.ai.mcp.server.prompt-change-notificationtrue提示变更通知
spring.ai.mcp.server.capabilities.resourcetrue资源能力
spring.ai.mcp.server.capabilities.tooltrue工具能力
spring.ai.mcp.server.capabilities.prompttrue提示能力
spring.ai.mcp.server.capabilities.completiontrue补全能力

客户端

属性默认值说明
spring.ai.mcp.client.enabledtrue启用 MCP 客户端
spring.ai.mcp.client.namespring-ai-mcp-client客户端名称
spring.ai.mcp.client.version1.0.0客户端版本
spring.ai.mcp.client.typeSYNC客户端类型(SYNC / ASYNC)
spring.ai.mcp.client.request-timeout20s请求超时
spring.ai.mcp.client.toolcallback.enabledtrue自动注册为 ToolCallback
spring.ai.mcp.client.stdio.connections.<name>.command启动命令
spring.ai.mcp.client.stdio.connections.<name>.args[]命令行参数
spring.ai.mcp.client.stdio.connections.<name>.env{}环境变量
spring.ai.mcp.client.sse.connections.<name>.urlSSE URL
spring.ai.mcp.client.sse.connections.<name>.sse-endpointSSE 端点

6. 向量数据库

PGVector

属性默认值说明
spring.ai.vectorstore.pgvector.initialize-schemafalse初始化表结构
spring.ai.vectorstore.pgvector.dimensions向量维度
spring.ai.vectorstore.pgvector.index-typeHNSW索引类型
spring.ai.vectorstore.pgvector.distance-typeCOSINE_DISTANCE距离度量
spring.ai.vectorstore.pgvector.table-namevector_store表名
spring.ai.vectorstore.pgvector.schema-namepublicSchema 名
spring.ai.vectorstore.pgvector.id-typeUUIDID 类型
spring.ai.vectorstore.pgvector.remove-existing-vector-store-tablefalse删除现有表

Pinecone

属性默认值说明
spring.ai.vectorstore.pinecone.api-keyAPI 密钥
spring.ai.vectorstore.pinecone.environmentgcp-starter环境名
spring.ai.vectorstore.pinecone.project-id项目 ID
spring.ai.vectorstore.pinecone.index-name索引名
spring.ai.vectorstore.pinecone.namespace命名空间
spring.ai.vectorstore.pinecone.server-side-timeout20s服务端超时

Qdrant

属性默认值说明
spring.ai.vectorstore.qdrant.hostlocalhost主机
spring.ai.vectorstore.qdrant.port6334端口
spring.ai.vectorstore.qdrant.use-tlsfalse启用 TLS
spring.ai.vectorstore.qdrant.api-keyAPI 密钥
spring.ai.vectorstore.qdrant.collection-name集合名

Milvus

属性默认值说明
spring.ai.vectorstore.milvus.database-name数据库名
spring.ai.vectorstore.milvus.collection-name集合名
spring.ai.vectorstore.milvus.embedding-dimension嵌入维度
spring.ai.vectorstore.milvus.index-typeIVF_FLAT索引类型
spring.ai.vectorstore.milvus.metric-typeCOSINE度量类型
spring.ai.vectorstore.milvus.index-parameters{"nlist":1024}索引参数
spring.ai.vectorstore.milvus.client.hostlocalhostMilvus 主机
spring.ai.vectorstore.milvus.client.port19530Milvus 端口
spring.ai.vectorstore.milvus.client.uriMilvus URI
spring.ai.vectorstore.milvus.client.token认证令牌
spring.ai.vectorstore.milvus.client.usernameroot用户名
spring.ai.vectorstore.milvus.client.passwordmilvus密码
spring.ai.vectorstore.milvus.client.connect-timeout-ms10000连接超时(ms)
spring.ai.vectorstore.milvus.client.securefalse启用 TLS

Redis

属性默认值说明
spring.ai.vectorstore.redis.initialize-schemafalse初始化索引
spring.ai.vectorstore.redis.index-namedefault-index索引名
spring.ai.vectorstore.redis.prefixdefault:键前缀

Elasticsearch

属性默认值说明
spring.ai.vectorstore.elasticsearch.initialize-schemafalse初始化索引
spring.ai.vectorstore.elasticsearch.index-name索引名
spring.ai.vectorstore.elasticsearch.dimensions向量维度
spring.ai.vectorstore.elasticsearch.similarity相似度函数

Weaviate

属性默认值说明
spring.ai.vectorstore.weaviate.schemehttp协议
spring.ai.vectorstore.weaviate.hostlocalhost:8080主机
spring.ai.vectorstore.weaviate.api-keyAPI 密钥
spring.ai.vectorstore.weaviate.object-classSpringAiWeaviate对象类名
spring.ai.vectorstore.weaviate.consistency-levelONE一致性级别
spring.ai.vectorstore.weaviate.headers{}自定义 HTTP 头

Chroma

属性默认值说明
spring.ai.vectorstore.chroma.client.hosthttp://localhostChroma 主机
spring.ai.vectorstore.chroma.client.port8000Chroma 端口
spring.ai.vectorstore.chroma.client.key-tokenAPI 令牌
spring.ai.vectorstore.chroma.client.username用户名
spring.ai.vectorstore.chroma.client.password密码
spring.ai.vectorstore.chroma.collection-name集合名
spring.ai.vectorstore.chroma.database-name数据库名
spring.ai.vectorstore.chroma.tenant-name租户名

MongoDB Atlas

属性默认值说明
spring.ai.vectorstore.mongodb.initialize-schemafalse初始化结构
spring.ai.vectorstore.mongodb.collection-namevector_store集合名
spring.ai.vectorstore.mongodb.index-namevector_index索引名
spring.ai.vectorstore.mongodb.path-nameembedding向量路径名
spring.ai.vectorstore.mongodb.metadata-fields-to-filter[]元数据过滤字段

Neo4j

属性默认值说明
spring.ai.vectorstore.neo4j.initialize-schemafalse初始化 Schema
spring.ai.vectorstore.neo4j.database-name数据库名
spring.ai.vectorstore.neo4j.embedding-dimension嵌入维度
spring.ai.vectorstore.neo4j.distance-typeCOSINE距离类型
spring.ai.vectorstore.neo4j.label节点标签
spring.ai.vectorstore.neo4j.index-name索引名

OpenSearch

属性默认值说明
spring.ai.vectorstore.opensearch.uris[]OpenSearch 实例 URI
spring.ai.vectorstore.opensearch.index-name索引名
spring.ai.vectorstore.opensearch.username用户名
spring.ai.vectorstore.opensearch.password密码
spring.ai.vectorstore.opensearch.connection-timeout连接超时
spring.ai.vectorstore.opensearch.read-timeout读取超时
spring.ai.vectorstore.opensearch.aws.domain-nameAWS 域名
spring.ai.vectorstore.opensearch.aws.regionAWS 区域
spring.ai.vectorstore.opensearch.aws.access-keyAWS 访问密钥
spring.ai.vectorstore.opensearch.aws.secret-keyAWS 秘密密钥

Oracle

属性默认值说明
spring.ai.vectorstore.oracle.initialize-schemafalse初始化表结构
spring.ai.vectorstore.oracle.table-name表名
spring.ai.vectorstore.oracle.index-type索引类型
spring.ai.vectorstore.oracle.distance-type距离类型
spring.ai.vectorstore.oracle.dimensions向量维度
spring.ai.vectorstore.oracle.remove-existing-vector-store-tablefalse删除现有表

Cassandra

属性默认值说明
spring.ai.vectorstore.cassandra.initialize-schemafalse初始化 Schema
spring.ai.vectorstore.cassandra.keyspace键空间
spring.ai.vectorstore.cassandra.table表名
spring.ai.vectorstore.cassandra.index-name索引名
属性默认值说明
spring.ai.vectorstore.azure.urlAzure 搜索端点 URL
spring.ai.vectorstore.azure.api-keyAPI 密钥
spring.ai.vectorstore.azure.index-name索引名
spring.ai.vectorstore.azure.default-top-k-1默认 Top-K
spring.ai.vectorstore.azure.default-similarity-threshold-1默认相似度阈值
spring.ai.vectorstore.azure.use-keyless-authfalse无密钥认证

Azure Cosmos DB

属性默认值说明
spring.ai.vectorstore.cosmosdb.initialize-schemafalse初始化结构
spring.ai.vectorstore.cosmosdb.container-name容器名
spring.ai.vectorstore.cosmosdb.database-name数据库名
spring.ai.vectorstore.cosmosdb.endpointCosmos DB 端点
spring.ai.vectorstore.cosmosdb.keyCosmos DB 密钥
spring.ai.vectorstore.cosmosdb.vector-dimensions1536向量维度
spring.ai.vectorstore.cosmosdb.vector-store-throughput400吞吐量(RU/s)
spring.ai.vectorstore.cosmosdb.partition-key-path分区键路径

MariaDB

属性默认值说明
spring.ai.vectorstore.mariadb.initialize-schemafalse初始化表结构
spring.ai.vectorstore.mariadb.dimensions向量维度
spring.ai.vectorstore.mariadb.distance-typeCOSINE距离类型
spring.ai.vectorstore.mariadb.table-name表名
spring.ai.vectorstore.mariadb.schema-nameSchema 名
spring.ai.vectorstore.mariadb.remove-existing-vector-store-tablefalse删除现有表

Typesense

属性默认值说明
spring.ai.vectorstore.typesense.client.protocolhttp协议
spring.ai.vectorstore.typesense.client.hostlocalhost主机
spring.ai.vectorstore.typesense.client.port8108端口
spring.ai.vectorstore.typesense.client.api-keyxyzAPI 密钥
spring.ai.vectorstore.typesense.collection-name集合名
spring.ai.vectorstore.typesense.embedding-dimension嵌入维度

Couchbase

属性默认值说明
spring.ai.vectorstore.couchbase.initialize-schemafalse初始化索引
spring.ai.vectorstore.couchbase.index-name索引名
spring.ai.vectorstore.couchbase.collection-name集合名
spring.ai.vectorstore.couchbase.scope-name作用域名
spring.ai.vectorstore.couchbase.bucket-name桶名
spring.ai.vectorstore.couchbase.dimensions向量维度
spring.ai.vectorstore.couchbase.similarity相似度函数

GemFire

属性默认值说明
spring.ai.vectorstore.gemfire.hostGemFire 主机
spring.ai.vectorstore.gemfire.portGemFire 端口
spring.ai.vectorstore.gemfire.index-name索引名
spring.ai.vectorstore.gemfire.beam-width100Beam 宽度
spring.ai.vectorstore.gemfire.max-connections16最大连接数
spring.ai.vectorstore.gemfire.vector-similarity-functionCOSINE相似度函数