chatgpt-api/readme.md

234 wiersze
23 KiB
Markdown
Czysty Zwykły widok Historia

2024-05-17 01:22:07 +00:00
<p align="center">
2024-08-17 11:53:23 +00:00
<a href="https://agentic.so">
<img alt="Agentic" src="/docs/media/agentic-header.jpg" width="308">
</a>
2024-05-17 01:22:07 +00:00
</p>
<p align="center">
2024-06-07 07:49:01 +00:00
<em>AI agent stdlib that works with any LLM and TypeScript AI SDK.</em>
2024-05-17 01:22:07 +00:00
</p>
<p align="center">
2024-06-07 07:13:41 +00:00
<a href="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml"><img alt="Build Status" src="https://github.com/transitive-bullshit/agentic/actions/workflows/main.yml/badge.svg" /></a>
2024-06-04 11:30:36 +00:00
<a href="https://www.npmjs.com/package/@agentic/stdlib"><img alt="NPM" src="https://img.shields.io/npm/v/@agentic/stdlib.svg" /></a>
2024-06-07 07:13:41 +00:00
<a href="https://github.com/transitive-bullshit/agentic/blob/main/license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-blue" /></a>
2024-05-17 01:22:07 +00:00
<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-07 07:18:36 +00:00
- [Intro](#intro)
- [Under the hood](#under-the-hood)
2025-03-24 15:10:20 +00:00
- [Features](#features)
2024-08-17 11:53:23 +00:00
- [Docs](#docs)
2024-08-17 12:02:01 +00:00
- [AI SDKs](#ai-sdks)
- [Vercel AI SDK](#vercel-ai-sdk)
- [Mastra](#mastra)
2024-08-17 12:02:01 +00:00
- [LangChain](#langchain)
- [LlamaIndex](#llamaindex)
- [Firebase Genkit](#firebase-genkit)
- [Dexa Dexter](#dexa-dexter)
- [OpenAI](#openai)
2025-02-20 19:29:04 +00:00
- [GenAIScript](#genaiscript)
2025-03-20 09:37:16 +00:00
- [xsAI SDK](#xsai-sdk)
2024-08-17 12:02:01 +00:00
- [Tools](#tools)
2024-06-07 07:18:36 +00:00
- [Contributors](#contributors)
- [License](#license)
## Intro
2024-06-03 22:09:28 +00:00
2025-03-24 14:51:40 +00:00
Agentic is a **standard library of AI functions / tools** which are **optimized for both normal TS-usage as well as LLM-based usage**. Agentic works with all of the major TS AI SDKs (Vercel AI SDK, Mastra, LangChain, LlamaIndex, OpenAI SDK, MCP, etc).
2024-06-03 22:09:28 +00:00
2024-08-04 10:55:47 +00:00
Agentic clients like `WeatherClient` can be used as normal TS classes:
2024-06-03 22:09:28 +00:00
```ts
import { WeatherClient } from '@agentic/stdlib'
2024-08-17 11:53:23 +00:00
// Requires `process.env.WEATHER_API_KEY` (free from weatherapi.com)
2024-08-04 10:55:47 +00:00
const weather = new WeatherClient()
2024-06-03 22:09:28 +00:00
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)
```
2025-03-24 15:10:20 +00:00
Or you can use these clients as **LLM-based tools**.
2024-06-06 03:00:30 +00:00
This works across all the leading AI SDKs via adapters. 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/ai-sdk'
2024-06-03 22:09:28 +00:00
// sdk-agnostic imports
import { WeatherClient } from '@agentic/stdlib'
const weather = new WeatherClient()
const result = await generateText({
2024-08-04 10:55:47 +00:00
model: openai('gpt-4o-mini'),
// this is the key line which uses the `@agentic/ai-sdk` adapter
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 23:55:19 +00:00
You can use our standard library of thoroughly tested AI functions with your favorite AI SDK – without having to write any glue code!
2024-06-06 03:00:30 +00:00
2025-03-24 15:10:20 +00:00
All Agentic clients expose an `AIFunctionSet`, which makes it easy to mix & match different tools together.
2025-03-24 14:51:40 +00:00
```ts
import { SerperClient, WikipediaClient, FirecrawlClient } from '@agentic/stdlib'
const googleSearch = new SerperClient()
const wikipedia = new WikipediaClient()
const firecrawl = new FirecrawlClient()
const result = await generateText({
model: openai('gpt-4o-mini'),
2025-03-24 15:33:18 +00:00
// This example uses tools from 3 different clients. You can pass as many
// tool sources as you want.
2025-03-24 14:51:40 +00:00
tools: createAISDKTools(
googleSearch,
wikipedia,
// Pick a single function from the firecrawl client's set of AI functions
firecrawl.functions.pick('firecrawl_search')
),
toolChoice: 'required',
prompt:
2025-03-24 15:10:20 +00:00
'What year did Jurassic Park the movie come out, and what else happened that year?'
2025-03-24 14:51:40 +00:00
})
```
### Under the hood
2025-03-24 15:33:18 +00:00
All adapters (like `createAISDKTools`) accept a very flexible var args of `AIFunctionLike` parameters, so you can pass as many tools as you'd like. An `AIFunctionLike` can be any agentic client instance, a single `AIFunction` selected from the client's `.functions` property (which holds an `AIFunctionSet` of available AI functions), or an AI function created manually via `createAIFunction`.
2025-03-24 15:10:20 +00:00
`AIFunctionLike` and `AIFunctionSet` are implementation details that you likely won't have to touch directly, but they're important because of their flexibility.
## Features
2025-03-24 15:33:18 +00:00
- ✅ All tools are thoroughly tested in production
2025-03-24 15:14:17 +00:00
- ✅ Tools work across all leading TS AI SDKs
- ✅ Tools are hand-coded and extremely minimal
- ✅ Tools have both a good manual DX and LLM DX via the `@aiFunction` decorator
- ✅ Tools use native `fetch`
2025-03-24 15:59:44 +00:00
- ✅ Tools use [ky](https://github.com/sindresorhus/ky) to wrap `fetch`, so HTTP options, throttling, retries, etc are easy to customize
2025-03-24 15:14:17 +00:00
- ✅ Supports tools from any MCP server ([createMcpTools(...)](https://agentic.so/tools/mcp))
- ✅ Generate new Agentic tool clients from OpenAPI specs ([@agentic/openapi-to-ts](./packages/openapi-to-ts))
2025-03-24 15:33:18 +00:00
- ✅ 100% open source && not trying to sell you anything 💯
2024-08-17 12:02:01 +00:00
## Docs
2024-06-03 22:09:28 +00:00
2024-08-17 12:02:01 +00:00
Full docs are available at [agentic.so](https://agentic.so).
2024-06-04 11:30:36 +00:00
2024-08-17 12:02:01 +00:00
## AI SDKs
2024-06-04 11:30:36 +00:00
2024-08-17 12:02:01 +00:00
### Vercel AI SDK
2024-06-03 22:09:28 +00:00
2024-08-17 12:02:01 +00:00
[Agentic adapter docs for the Vercel AI SDK](https://agentic.so/sdks/ai-sdk)
2024-06-07 07:18:36 +00:00
### Mastra
[Agentic adapter docs for the Mastra AI Agent framework](https://agentic.so/sdks/mastra)
2024-08-17 12:02:01 +00:00
### LangChain
[Agentic adapter docs for LangChain](https://agentic.so/sdks/langchain)
### LlamaIndex
[Agentic adapter docs for LlamaIndex](https://agentic.so/sdks/llamaindex)
### Firebase Genkit
[Agentic adapter docs for Genkit](https://agentic.so/sdks/genkit)
### Dexa Dexter
[Agentic adapter docs for Dexter](https://agentic.so/sdks/dexter)
### OpenAI
[Agentic adapter docs for OpenAI](https://agentic.so/sdks/openai)
2024-08-26 15:25:58 +00:00
### GenAIScript
[Agentic support in GenAIScript](https://agentic.so/sdks/genaiscript)
2025-03-20 09:37:16 +00:00
### xsAI SDK
[Agentic adapter docs for the xsAI SDK](https://agentic.so/sdks/xsai)
2024-08-17 12:02:01 +00:00
## Tools
| Service / Tool | Package | Docs | Description |
| ------------------------------------------------------------------------ | --------------------------- | ------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Apollo](https://docs.apollo.io) | `@agentic/apollo` | [docs](https://agentic.so/tools/apollo) | B2B person and company enrichment API. |
| [ArXiv](https://arxiv.org) | `@agentic/arxiv` | [docs](https://agentic.so/tools/arxiv) | Search for research articles. |
2024-08-17 12:02:01 +00:00
| [Bing](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api) | `@agentic/bing` | [docs](https://agentic.so/tools/bing) | Bing web search. |
| [Calculator](https://github.com/josdejong/mathjs) | `@agentic/calculator` | [docs](https://agentic.so/tools/calculator) | Basic calculator for simple mathematical expressions. |
| [Clearbit](https://dashboard.clearbit.com/docs) | `@agentic/clearbit` | [docs](https://agentic.so/tools/clearbit) | Resolving and enriching people and company data. |
| [Dexa](https://dexa.ai) | `@agentic/dexa` | [docs](https://agentic.so/tools/dexa) | Answers questions from the world's best podcasters. |
| [Diffbot](https://docs.diffbot.com) | `@agentic/diffbot` | [docs](https://agentic.so/tools/diffbot) | Web page classification and scraping; person and company data enrichment. |
| [DuckDuckGo](https://duckduckgo.com) | `@agentic/duck-duck-go` | [docs](https://agentic.so/tools/duck-duck-go) | Privacy-focused web search API. |
2024-10-29 18:38:20 +00:00
| [E2B](https://e2b.dev) | `@agentic/e2b` | [docs](https://agentic.so/tools/e2b) | Hosted Python code interpreter sandbox which is really useful for data analysis, flexible code execution, and advanced reasoning on-the-fly. |
2024-08-17 12:02:01 +00:00
| [Exa](https://docs.exa.ai) | `@agentic/exa` | [docs](https://agentic.so/tools/exa) | Web search tailored for LLMs. |
| [Firecrawl](https://www.firecrawl.dev) | `@agentic/firecrawl` | [docs](https://agentic.so/tools/firecrawl) | Website scraping and structured data extraction. |
2025-02-27 22:33:25 +00:00
| [Gravatar](https://docs.gravatar.com/api/profiles/rest-api/) | `@agentic/gravatar` | [docs](https://agentic.so/tools/gravatar) | Gravatar profile API. |
2024-08-17 12:02:01 +00:00
| [HackerNews](https://github.com/HackerNews/API) | `@agentic/hacker-news` | [docs](https://agentic.so/tools/hacker-news) | Official HackerNews API. |
| [Hunter](https://hunter.io) | `@agentic/hunter` | [docs](https://agentic.so/tools/hunter) | Email finder, verifier, and enrichment. |
| [Jina](https://jina.ai/reader) | `@agentic/jina` | [docs](https://agentic.so/tools/jina) | URL scraper and web search. |
| [LeadMagic](https://leadmagic.io) | `@agentic/leadmagic` | [docs](https://agentic.so/tools/leadmagic) | B2B person, company, and email enrichment API. |
2024-08-17 12:02:01 +00:00
| [Midjourney](https://www.imagineapi.dev) | `@agentic/midjourney` | [docs](https://agentic.so/tools/midjourney) | Unofficial Midjourney client for generative images. |
2025-03-23 16:55:31 +00:00
| [McpTools](https://modelcontextprotocol.io) | `@agentic/mcp` | [docs](https://agentic.so/tools/mcp) | Model Context Protocol (MCP) client, supporting any MCP server. Use [createMcpTools](https://agentic.so/tools/mcp) to spawn or connect to an MCP server. |
2024-08-17 12:02:01 +00:00
| [Novu](https://novu.co) | `@agentic/novu` | [docs](https://agentic.so/tools/novu) | Sending notifications (email, SMS, in-app, push, etc). |
| [People Data Labs](https://www.peopledatalabs.com) | `@agentic/people-data-labs` | [docs](https://agentic.so/tools/people-data-labs) | People & company data (WIP). |
| [Perigon](https://www.goperigon.com/products/news-api) | `@agentic/perigon` | [docs](https://agentic.so/tools/perigon) | Real-time news API and web content data from 140,000+ sources. Structured and enriched by AI, primed for LLMs. |
| [Polygon](https://polygon.io) | `@agentic/polygon` | [docs](https://agentic.so/tools/polygon) | Stock market and company financial data. |
| [PredictLeads](https://predictleads.com) | `@agentic/predict-leads` | [docs](https://agentic.so/tools/predict-leads) | In-depth company data including signals like fundraising events, hiring news, product launches, technologies used, etc. |
| [Proxycurl](https://nubela.co/proxycurl) | `@agentic/proxycurl` | [docs](https://agentic.so/tools/proxycurl) | People and company data from LinkedIn & Crunchbase. |
| [RocketReach](https://rocketreach.co/api/v2/docs) | `@agentic/rocketreach` | [docs](https://agentic.so/tools/rocketreach) | B2B person and company enrichment API. |
2024-08-17 12:02:01 +00:00
| [Searxng](https://docs.searxng.org) | `@agentic/searxng` | [docs](https://agentic.so/tools/searxng) | 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) | `@agentic/serpapi` | [docs](https://agentic.so/tools/serpapi) | Lightweight wrapper around SerpAPI for Google search. |
| [Serper](https://serper.dev) | `@agentic/serper` | [docs](https://agentic.so/tools/serper) | Lightweight wrapper around Serper for Google search. |
| [Slack](https://api.slack.com/docs) | `@agentic/slack` | [docs](https://agentic.so/tools/slack) | Send and receive Slack messages. |
| [SocialData](https://socialdata.tools) | `@agentic/social-data` | [docs](https://agentic.so/tools/social-data) | Unofficial Twitter / X client (readonly) which is much cheaper than the official Twitter API. |
| [Tavily](https://tavily.com) | `@agentic/tavily` | [docs](https://agentic.so/tools/tavily) | Web search API tailored for LLMs. |
| [Twilio](https://www.twilio.com/docs/conversations/api) | `@agentic/twilio` | [docs](https://agentic.so/tools/twilio) | Twilio conversation API to send and receive SMS messages. |
| [Twitter](https://developer.x.com/en/docs/twitter-api) | `@agentic/twitter` | [docs](https://agentic.so/tools/twitter) | Basic Twitter API methods for fetching users, tweets, and searching recent tweets. Includes support for plan-aware rate-limiting. Uses [Nango](https://www.nango.dev) for OAuth support. |
| [Weather](https://www.weatherapi.com) | `@agentic/weather` | [docs](https://agentic.so/tools/weather) | Basic access to current weather data based on location. |
| [Wikidata](https://www.wikidata.org/wiki/Wikidata:Data_access) | `@agentic/wikidata` | [docs](https://agentic.so/tools/wikidata) | Basic Wikidata client. |
| [Wikipedia](https://www.mediawiki.org/wiki/API) | `@agentic/wikipedia` | [docs](https://agentic.so/tools/wikipedia) | Wikipedia page search and summaries. |
| [Wolfram Alpha](https://products.wolframalpha.com/llm-api/documentation) | `@agentic/wolfram-alpha` | [docs](https://agentic.so/tools/wolfram-alpha) | Wolfram Alpha LLM API client for answering computational, mathematical, and scientific questions. |
2025-02-20 19:29:04 +00:00
| [ZoomInfo](https://api-docs.zoominfo.com) | `@agentic/zoominfo` | [docs](https://agentic.so/tools/zoominfo) | Powerful B2B person and company data enrichment. |
2024-08-17 12:02:01 +00:00
2025-03-24 16:00:15 +00:00
> [!NOTE] > **Missing a tool or want to add your own tool to this list?** If you have an OpenAPI v3 spec for your tool's API, we make it extremely easy to add support using our [@agentic/openapi-to-ts](./packages/openapi-to-ts) CLI. Otherwise, feel free to [open an issue to discuss](https://github.com/transitive-bullshit/agentic/issues/new?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen) or submit a PR.
2025-03-24 15:37:45 +00:00
For more details on tool usage, see the [docs](https://agentic.so).
2024-05-23 23:19:38 +00:00
## Contributors
- [Travis Fischer](https://x.com/transitive_bs)
- [David Zhang](https://x.com/dzhng)
- [Philipp Burckhardt](https://x.com/burckhap)
2025-03-18 13:18:36 +00:00
- And all of these [amazing OSS contributors](https://github.com/transitive-bullshit/agentic/graphs/contributors):
2025-03-18 13:18:36 +00:00
<p align="center">
<a href="https://github.com/transitive-bullshit/agentic/graphs/contributors">
2025-03-18 13:20:51 +00:00
<img src="https://contrib.rocks/image?repo=transitive-bullshit/agentic&max=150" width="600" />
2025-03-18 13:18:36 +00:00
</a>
</p>
2025-03-18 13:12:55 +00:00
2024-05-17 01:22:07 +00:00
## License
MIT © [Travis Fischer](https://x.com/transitive_bs)
2024-05-17 01:22:07 +00:00
To stay up to date or learn more, follow [@transitive_bs](https://x.com/transitive_bs) on Twitter.