SpringBoot 整合 LangChain4j 与 Tavily 实现联网搜索
要实现联网搜索功能,获取 API Key 是必不可少的关键步骤。首先需要在 Tavily 官网注册账号并申请密钥。
获取 Tavily API Key
访问 Tavily 官网 注册账号,进入 API Playground 填写申请信息,随后在 Overview 页面即可查看生成的 API 密钥。

获得 API 密钥后,即可在项目中完成相应配置。可以通过 max-results 来控制最多搜索结果数量。
langchain4j:
open-ai:
chat-model:
base-url: https://dashscope.aliyuncs.com/compatible-mode/v1
api-key: ${QWEN_API_KEY}
model-name: qwen-plus
log-responses: true
log-requests: true
strict-tools: true
streaming-chat-model:
base-url: https://dashscope.aliyuncs.com/compatible-mode/v1
api-key: ${QWEN_API_KEY}
model-name: qwen-plus
log-responses: true
log-requests: true
strict-tools: true
embedding-model:
base-url: https://dashscope.aliyuncs.com/compatible-mode/v1
api-key:





