agentic
7.2.0

与任何LLM和Typescript AI SDK一起使用的AI代理STDLIB。

代理是AI功能 /工具的标准库,可针对正常的TS-使用和基于LLM的用法进行优化。代理与所有主要TS AI SDK(Langchain,Llamaindex,Vercel AI SDK,OpenAI SDK等)合作。
像WeatherClient这样的代理客户可以用作普通TS类:
import { WeatherClient } from '@agentic/stdlib'
// Requires `process.env.WEATHER_API_KEY` (free from weatherapi.com)
const weather = new WeatherClient ( )
const result = await weather . getCurrentWeather ( {
q : 'San Francisco'
} )
console . log ( result )或者,您可以将这些客户端用作基于LLM的工具,其中LLM决定何时以及如何为您调用基础功能。
这通过适配器在所有主要的AI SDK上都起作用。这是使用Vercel的AI SDK的示例:
// sdk-specific imports
import { openai } from '@ai-sdk/openai'
import { generateText } from 'ai'
import { createAISDKTools } from '@agentic/ai-sdk'
// sdk-agnostic imports
import { WeatherClient } from '@agentic/stdlib'
const weather = new WeatherClient ( )
const result = await generateText ( {
model : openai ( 'gpt-4o-mini' ) ,
// this is the key line which uses the `@agentic/ai-sdk` adapter
tools : createAISDKTools ( weather ) ,
toolChoice : 'required' ,
prompt : 'What is the weather in San Francisco?'
} )
console . log ( result . toolResults [ 0 ] )您可以使用您喜欢的AI SDK使用我们的标准库,其中包括彻底测试的AI功能 - 而无需编写任何胶水代码!
这是一个稍微复杂的示例,它使用了多个客户端,并使用AIFunctionSet.pick进行了选择的子集。
// sdk-specific imports
import { ChatModel , createAIRunner } from '@dexaai/dexter'
import { createDexterFunctions } from '@agentic/dexter'
// sdk-agnostic imports
import { PerigonClient , SerperClient } from '@agentic/stdlib'
async function main ( ) {
// Perigon is a news API and Serper is a Google search API
const perigon = new PerigonClient ( )
const serper = new SerperClient ( )
const runner = createAIRunner ( {
chatModel : new ChatModel ( {
params : { model : 'gpt-4o-mini' , temperature : 0 }
} ) ,
functions : createDexterFunctions (
perigon . functions . pick ( 'search_news_stories' ) ,
serper
) ,
systemMessage : 'You are a helpful assistant. Be as concise as possible.'
} )
const result = await runner (
'Summarize the latest news stories about the upcoming US election.'
)
console . log ( result )
} 完整的文档可在Agentic.so上找到。
Vercel AI SDK的代理适配器文档
Langchain的代理适配器文档
LlamainDex的代理适配器文档
Genkit的代理适配器文档
Dexter的代理适配器文档
Openai的代理适配器文档
Genaiscript中的代理支持
| 服务 /工具 | 包裹 | 文档 | 描述 |
|---|---|---|---|
| bing | @agentic/bing | 文档 | Bing Web搜索。 |
| 计算器 | @agentic/calculator | 文档 | 简单数学表达式的基本计算器。 |
| Clearbit | @agentic/clearbit | 文档 | 解决和丰富人员和公司数据。 |
| dexa | @agentic/dexa | 文档 | 回答世界上最好的播客的问题。 |
| difbot | @agentic/diffbot | 文档 | 网页分类和刮擦;人和公司数据丰富。 |
| E2B | @agentic/e2b | 文档 | 托管了Python代码解释器沙箱,它对数据分析,灵活的代码执行和高级推理非常有用。 |
| EXA | @agentic/exa | 文档 | 针对LLMS量身定制的Web搜索。 |
| 火 | @agentic/firecrawl | 文档 | 网站刮擦和结构化数据提取。 |
| 黑客 | @agentic/hacker-news | 文档 | Hackernew官方API。 |
| 猎人 | @agentic/hunter | 文档 | 电子邮件查找器,验证者和丰富。 |
| 吉纳 | @agentic/jina | 文档 | URL刮板和网络搜索。 |
| Midjourney | @agentic/midjourney | 文档 | 非正式的Midjourney客户端用于生成图像。 |
| 诺夫 | @agentic/novu | 文档 | 发送通知(电子邮件,SMS,应用程序内,推送等)。 |
| 人数据实验室 | @agentic/people-data-labs | 文档 | 人与公司数据(WIP)。 |
| Perigon | @agentic/perigon | 文档 | 来自140,000多个来源的实时新闻API和Web内容数据。由AI结构并富集,用于LLM。 |
| 多边形 | @agentic/polygon | 文档 | 股票市场和公司财务数据。 |
| 预测假 | @agentic/predict-leads | 文档 | 深入的公司数据包括筹款活动,招聘新闻,产品发布,所使用的技术等信号等。 |
| proxycurl | @agentic/proxycurl | 文档 | LinkedIn和Crunchbase的人和公司数据。 |
| searxng | @agentic/searxng | 文档 | OSS META搜索引擎能够在许多提供商中进行搜索,例如Reddit,Google,Brave,Arxiv,Genius,IMDB,腐烂的西红柿,Wikidata,Wolfram Alpha,YouTube,GitHub,Github,等。 |
| serpapi | @agentic/serpapi | 文档 | SERPAPI周围的轻量级包装器可用于Google搜索。 |
| 详细 | @agentic/serper | 文档 | 轻巧的包装器周围的Serper可用于Google搜索。 |
| 松弛 | @agentic/slack | 文档 | 发送并接收松弛消息。 |
| 社会 | @agentic/social-data | 文档 | 非官方的Twitter / X客户端(ReadOnly)比官方Twitter API便宜得多。 |
| 坦率 | @agentic/tavily | 文档 | 针对LLMS量身定制的Web搜索API。 |
| Twilio | @agentic/twilio | 文档 | Twilio对话API发送和接收SMS消息。 |
| 叽叽喳喳 | @agentic/twitter | 文档 | 用于获取用户,推文和搜索最近推文的基本Twitter API方法。包括支持计划限制速率的支持。使用Nango进行OAuth支持。 |
| 天气 | @agentic/weather | 文档 | 基于位置对当前天气数据的基本访问。 |
| Wikidata | @agentic/wikidata | 文档 | 基本Wikidata客户端。 |
| 维基百科 | @agentic/wikipedia | 文档 | Wikipedia页面搜索和摘要。 |
| Wolfram Alpha | @agentic/wolfram-alpha | 文档 | Wolfram Alpha LLM API客户端用于回答计算,数学和科学问题。 |
有关更多详细信息,请参阅文档。
麻省理工学院©Travis Fischer
要保持最新信息或了解更多信息,请在Twitter上关注@Transistion_bs。