A simple blog built by Django
语音 Agent:三明治架构实现语音助手
| Published by rcdfrd 语音 Agent:三明治架构实现语音助手
语音 Agent 有两种架构。端到端架构直接用多模态模型处理音频输入输出,门槛高。三明治架构是更实用的方案:语音转文字、Agent 处理、文字转语音。
语音转文字
用 OpenAI 的 Whisper 模型做 STT:
from openai import OpenAI
stt_client = OpenAI()
with open("data/hel
Read more ⟶
SQL Agent:让大模型直接查数据库
| Published by rcdfrd SQL Agent:让大模型直接查数据库
不会写 SQL 的产品经理想查数据?让大模型来。LangChain 的 SQL Agent 能自动分析表结构、生成查询、执行并返回结果。
基本搭建
from langchain_community.utilities import SQLDatabase
from langchain_community.agent_toolkits import SQLD
Read more ⟶
Human in the Loop:给 Agent 加上人工审核
| Published by rcdfrd Human in the Loop:给 Agent 加上人工审核
Agent 调用工具之前,有时候你想先看一眼,确认没问题再执行。比如 SQL 删除操作、发邮件这类不可逆动作。Human-in-the-Loop 就干这个。
基本用法
LangChain 1.0 用 HumanInTheLoopMiddleware 实现:
from langchain.agents import create_ag
Read more ⟶