2024-05-17 01:22:07 +00:00
< p align = "center" >
2024-06-04 12:17:55 +00:00
< a href = "https://trywalter.ai" > < img alt = "Agentic" src = "/media/agentic-header.jpg" width = "308" > < / a >
2024-05-17 01:22:07 +00:00
< / p >
< p align = "center" >
2024-06-06 05:40:38 +00:00
< em > AI agent stdlib that works with any TypeScript AI SDK and LLM< / em >
2024-05-17 01:22:07 +00:00
< / p >
< p align = "center" >
2024-06-04 11:30:36 +00:00
< a href = "https://github.com/transitive-bullshit/walter/actions/workflows/main.yml" > < img alt = "Build Status" src = "https://github.com/transitive-bullshit/walter/actions/workflows/main.yml/badge.svg" / > < / a >
< a href = "https://www.npmjs.com/package/@agentic/stdlib" > < img alt = "NPM" src = "https://img.shields.io/npm/v/@agentic/stdlib.svg" / > < / a >
2024-05-17 01:22:07 +00:00
< a href = "https://github.com/transitive-bullshit/walter/blob/main/license" > < img alt = "MIT License" src = "https://img.shields.io/badge/license-MIT-blue" / > < / a >
< a href = "https://prettier.io" > < img alt = "Prettier Code Formatting" src = "https://img.shields.io/badge/code_style-prettier-brightgreen.svg" / > < / a >
< / p >
2024-06-04 11:30:36 +00:00
# Agentic <!-- omit from toc -->
2024-05-17 01:22:07 +00:00
2024-06-04 11:30:36 +00:00
> [!WARNING]
> TODO: this project is not published yet and is an active WIP.
2024-06-03 22:09:28 +00:00
2024-06-06 05:40:38 +00:00
The goal of this project is to create a **set of standard AI functions / tools** which are **optimized for both normal TS-usage as well as LLM-based apps** and that work with all of the major AI SDKs (LangChain, LlamaIndex, Vercel AI SDK, OpenAI SDK, etc).
2024-06-03 22:09:28 +00:00
2024-06-06 05:40:38 +00:00
For example, stdlib clients like `WeatherClient` can be used normally as a fully-typed TS client:
2024-06-03 22:09:28 +00:00
```ts
import { WeatherClient } from '@agentic/stdlib'
const weather = new WeatherClient() // (requires `WEATHER_API_KEY` env var)
2024-06-06 05:29:30 +00:00
const result = await weather.getCurrentWeather({
2024-06-03 22:09:28 +00:00
q: 'San Francisco'
})
console.log(result)
```
2024-06-06 03:11:11 +00:00
Or you can use this same function an LLM-based tool which works across all of the major AI SDKs via adaptors.
2024-06-06 03:00:30 +00:00
2024-06-06 03:11:11 +00:00
Here's an example using [Vercel's AI SDK ](https://github.com/vercel/ai ):
2024-06-03 22:09:28 +00:00
```ts
// sdk-specific imports
import { openai } from '@ai-sdk/openai'
import { generateText } from 'ai'
import { createAISDKTools } from '@agentic/stdlib/ai-sdk'
// sdk-agnostic imports
import { WeatherClient } from '@agentic/stdlib'
const weather = new WeatherClient()
const result = await generateText({
model: openai('gpt-4o'),
2024-06-06 03:00:30 +00:00
// this is the key line which uses the ai-sdk adaptor
2024-06-03 22:09:28 +00:00
tools: createAISDKTools(weather),
toolChoice: 'required',
prompt: 'What is the weather in San Francisco?'
})
console.log(result.toolResults[0])
```
2024-06-06 03:11:11 +00:00
You can use all of our thoroughly tested stdlib AI functions with your favorite AI SDK – without having to write any glue code!
2024-06-06 03:00:30 +00:00
Here's a slightly more complex example which uses multiple clients and selects a subset of their functions using the `AIFunctionSet.pick` method:
2024-06-03 22:09:28 +00:00
```ts
// sdk-specific imports
import { ChatModel, createAIRunner } from '@dexaai/dexter'
import { createDexterFunctions } from '@agentic/stdlib/dexter'
// sdk-agnostic imports
import { PerigonClient, SerperClient } from '@agentic/stdlib'
async function main() {
const perigon = new PerigonClient()
const serper = new SerperClient()
const runner = createAIRunner({
chatModel: new ChatModel({
params: { model: 'gpt-4o', temperature: 0 }
}),
functions: createDexterFunctions(
perigon.functions.pick('search_news_stories'),
serper
),
2024-06-06 02:50:19 +00:00
systemMessage: `You are a helpful assistant. Be as concise as possible.`
2024-06-03 22:09:28 +00:00
})
const result = await runner(
'Summarize the latest news stories about the upcoming US election.'
)
console.log(result)
}
```
2024-06-06 03:11:11 +00:00
Here we've exposed 2 functions to the LLM, `search_news_stories` (which comes from the `PerigonClient.searchStories` method) and `serper_google_search` (which implicitly comes from the `SerperClient.search` method).
2024-06-03 22:09:28 +00:00
2024-06-06 03:11:11 +00:00
All of the SDK adaptors like `createDexterFunctions` accept very flexible in what they accept. `AIFunctionLike` objects include:
2024-06-04 11:30:36 +00:00
- `AIFunctionSet` - Sets of AI functions (like `perigon.functions.pick('search_news_stories')` or `perigon.functions` or `serper.functions` )
- `AIFunctionsProvider` - Client classes which expose an `AIFunctionSet` via the `.functions` property (like `perigon` or `serper` )
2024-06-06 03:11:11 +00:00
- `AIFunction` - Individual functions (like `perigon.functions.get('search_news_stories')` or `serper.functions.get('serper_google_search')` or AI functions created directly via the `createAIFunction` utility function)
2024-06-04 11:30:36 +00:00
2024-06-06 03:11:11 +00:00
You can pass as many of these `AIFunctionLike` objects as you'd like and you can manipulate them as `AIFunctionSet` sets via `.pick` , `.omit` , `.get` , `.map` , etc.
2024-06-03 22:09:28 +00:00
2024-06-06 03:00:30 +00:00
All heavy third-party imports are isolated as _optional peer dependencies_ to keep the main `@agentic/stdlib` package as lightweight as possible.
2024-06-03 22:09:28 +00:00
2024-05-23 23:19:38 +00:00
## Services
2024-06-06 02:45:48 +00:00
| Service | Client | Description |
| ------------------------------------------------------------------------ | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Bing ](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api ) | `BingClient` | Bing web search. |
2024-06-06 05:40:38 +00:00
| [Calculator ](https://github.com/silentmatt/expr-eval ) | `calculator` | Basic calculator for simple mathematical expressions. |
2024-06-06 02:45:48 +00:00
| [Clearbit ](https://dashboard.clearbit.com/docs ) | `ClearbitClient` | Resolving and enriching people and company datae. |
| [Dexa ](https://dexa.ai ) | `DexaClient` | Answers questions from the world's best podcasters. |
| [Diffbot ](https://docs.diffbot.com ) | `DiffbotClient` | Web page classification and scraping; person and company data enrichment. |
2024-06-06 05:40:38 +00:00
| [E2B ](https://e2b.dev ) | `e2b` | Hosted Python code intrepreter sandbox which is really useful for data analysis, flexible code execution, and advanced reasoning on-the-fly. |
2024-06-06 02:45:48 +00:00
| [Exa ](https://docs.exa.ai ) | `ExaClient` | Web search tailored for LLMs. |
| [Firecrawl ](https://www.firecrawl.dev ) | `FirecrawlClient` | Website scraping and sanitization. |
| [Midjourney ](https://www.imagineapi.dev ) | `MidjourneyClient` | Unofficial Midjourney client for generative images. |
| [Novu ](https://novu.co ) | `NovuClient` | Sending notifications (email, SMS, in-app, push, etc). |
| [People Data Labs ](https://www.peopledatalabs.com ) | `PeopleDataLabsClient` | People & company data (WIP). |
| [Perigon ](https://www.goperigon.com/products/news-api ) | `PerigonClient` | Real-time news API and web content data from 140,000+ sources. Structured and enriched by AI, primed for LLMs. |
| [Polygon ](https://polygon.io ) | `PolygonClient` | Stock market and company financial data. |
| [PredictLeads ](https://predictleads.com ) | `PredictLeadsClient` | In-depth company data including signals like fundraising events, hiring news, product launches, technologies used, etc. |
| [Proxycurl ](https://nubela.co/proxycurl ) | `ProxycurlClient` | People and company data from LinkedIn & Crunchbase. |
| Scraper | `ScraperClient` | Scrapes URLs into clean html/markdown/text content (TODO: currently closed beta). |
| [Searxng ](https://docs.searxng.org ) | `SearxngClient` | OSS meta search engine capable of searching across many providers like Reddit, Google, Brave, Arxiv, Genius, IMDB, Rotten Tomatoes, Wikidata, Wolfram Alpha, YouTube, GitHub, [etc ](https://docs.searxng.org/user/configured_engines.html#configured-engines ). |
| [SerpAPI ](https://serpapi.com/search-api ) | `SerpAPIClient` | Lightweight wrapper around SerpAPI for Google search. |
| [Serper ](https://serper.dev ) | `SerperClient` | Lightweight wrapper around Serper for Google search. |
2024-06-06 05:27:30 +00:00
| [Slack ](https://api.slack.com/docs ) | `SlackClient` | Send and receive Slack messages. |
2024-06-06 07:22:26 +00:00
| [Tavily ](https://tavily.com ) | `TavilyClient` | Web search API tailored for LLMs. 🔥 |
2024-06-06 05:27:30 +00:00
| [Twilio ](https://www.twilio.com/docs/conversations/api ) | `TwilioClient` | Twilio conversation API to send and receive SMS messages. |
2024-06-06 02:45:48 +00:00
| [Twitter ](https://developer.x.com/en/docs/twitter-api ) | `TwitterClient` | Basic Twitter API methods for fetching users, tweets, and searching recent tweets. Includes support for plan-aware rate-limiting. |
2024-06-06 05:40:38 +00:00
| [WeatherAPI ](https://www.weatherapi.com ) | `WeatherClient` | Basic access to current weather data based on location. |
2024-06-06 02:45:48 +00:00
| [Wikipedia ](https://www.mediawiki.org/wiki/API ) | `WikipediaClient` | Wikipedia page search and summaries. |
| [Wolfram Alpha ](https://products.wolframalpha.com/llm-api/documentation ) | `WolframAlphaClient` | Wolfram Alpha LLM API client for answering computational, mathematical, and scientific questions. |
2024-05-23 23:19:38 +00:00
2024-06-06 05:40:38 +00:00
## Compound Tools
2024-06-05 08:07:44 +00:00
- search and scrape
2024-06-03 22:09:28 +00:00
## AI SDKs
2024-06-02 08:06:45 +00:00
2024-06-05 03:10:19 +00:00
- OpenAI SDK
- no need for an adaptor; use `AIFunctionSet.specs` or `AIFunctionSet.toolSpecs`
- Vercel AI SDK
- `import { createAISDKTools } from '@agentic/stdlib/ai-sdk'`
- LangChain
- `import { createLangChainTools } from '@agentic/stdlib/langchain'`
- LlamaIndex
- `import { createLlamaIndexTools } from '@agentic/stdlib/llamaindex'`
- Firebase Genkit
- `import { createGenkitTools } from '@agentic/stdlib/genkit'`
- Dexa Dexter
- `import { createDexterFunctions } from '@agentic/stdlib/dexter'`
2024-06-02 08:06:45 +00:00
2024-06-06 02:50:19 +00:00
## Client Goals
- clients should be as minimal as possible
- clients should use `ky` and `zod` where possible
2024-06-06 05:08:11 +00:00
- clients should have a strongly-typed TS DX
2024-06-06 02:50:19 +00:00
- clients should expose select methods via the `@aiFunction(...)` decorator
- clients and AIFunctions should be composable via `AIFunctionSet`
2024-06-06 05:08:11 +00:00
- clients should work with all major TS AI SDKs
2024-06-06 02:50:19 +00:00
- SDK adaptors should be as lightweight as possible and be optional peer dependencies of `@agentic/stdlib`
2024-05-23 23:19:38 +00:00
## TODO
2024-06-02 22:30:39 +00:00
- rename this repo to agentic
2024-06-06 02:45:48 +00:00
- sdks
- modelfusion
2024-05-23 23:19:38 +00:00
- services
2024-06-06 02:45:48 +00:00
- perplexity
2024-06-03 06:19:10 +00:00
- replicate
- huggingface
2024-06-04 23:59:44 +00:00
- [skyvern ](https://github.com/Skyvern-AI/skyvern )
2024-05-23 23:19:38 +00:00
- pull from [langchain ](https://github.com/langchain-ai/langchainjs/tree/main/langchain )
2024-06-02 08:06:45 +00:00
- provide a converter for langchain `DynamicStructuredTool`
2024-05-23 23:19:38 +00:00
- pull from [nango ](https://docs.nango.dev/integrations/overview )
2024-06-04 23:59:44 +00:00
- pull from [activepieces ](https://github.com/activepieces/activepieces/tree/main/packages/pieces/community )
- general openapi support ala [workgpt ](https://github.com/team-openpm/workgpt )
2024-06-03 22:09:28 +00:00
- tools / chains / flows / runnables
- market maps
2024-06-03 17:26:46 +00:00
- https://github.com/causaly/zod-validation-error
2024-06-05 00:58:50 +00:00
- investigate [autotool ](https://github.com/run-llama/LlamaIndexTS/tree/main/packages/autotool )
- investigate [data connectors ](https://github.com/mendableai/data-connectors )
2024-05-23 23:19:38 +00:00
2024-05-17 01:22:07 +00:00
## License
2024-06-04 11:30:36 +00:00
MIT © [Travis Fischer ](https://twitter.com/transitive_bs )
2024-05-17 01:22:07 +00:00
To stay up to date or learn more, follow [@transitive_bs ](https://twitter.com/transitive_bs ) on Twitter.