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。