docs: improve docs

pull/659/head
Travis Fischer 2024-08-17 06:03:17 -05:00
rodzic 9296e75dd4
commit e65a0e6820
42 zmienionych plików z 708 dodań i 3138 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
--- ---
title: 'Agentic' title: Intro
description: 'AI agent stdlib that works with any LLM and TypeScript AI SDK.' description: Agentic is an AI agent stdlib that works with any LLM and TypeScript AI SDK.
--- ---
Agentic is a **standard library of AI tools** which are **optimized for both normal TS-usage as well as LLM-based usage**. Agentic is a **standard library of AI tools** which are **optimized for both normal TS-usage as well as LLM-based usage**.

Wyświetl plik

@ -35,20 +35,17 @@
"navigation": [ "navigation": [
{ {
"group": "Getting Started", "group": "Getting Started",
"pages": ["intro", "quickstart", "usage"]
},
{
"group": "AI SDKs",
"pages": [ "pages": [
"intro", "sdks/ai-sdk",
"quickstart", "sdks/langchain",
"usage", "sdks/llamaindex",
{ "sdks/genkit",
"group": "AI SDKs", "sdks/dexter",
"pages": [ "sdks/openai"
"sdks/ai-sdk",
"sdks/langchain",
"sdks/llamaindex",
"sdks/genkit",
"sdks/dexter"
]
}
] ]
}, },
{ {

Wyświetl plik

@ -1,9 +1,7 @@
--- ---
title: 'Quick Start' title: Quick Start
--- ---
## Install
<Info> <Info>
**Prerequisite**: All Agentic packages are [ESM **Prerequisite**: All Agentic packages are [ESM
only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
@ -52,19 +50,19 @@ title: 'Quick Start'
<Accordion title="Install individual AI tools"> <Accordion title="Install individual AI tools">
Docs for individual tools are available [here](/tools). Docs for individual tools are available [here](/tools).
Here's an example of how to install the `@agentic/calculator` tool: Here's an example of how to install the [Weather tool](/tools/weather):
<CodeGroup> <CodeGroup>
```bash npm ```bash npm
npm install @agentic/calculator npm install @agentic/weather
``` ```
```bash yarn ```bash yarn
yarn add @agentic/calculator yarn add @agentic/weather
``` ```
```bash pnpm ```bash pnpm
pnpm add @agentic/calculator pnpm add @agentic/weather
``` ```
</CodeGroup> </CodeGroup>
</Accordion> </Accordion>
@ -98,7 +96,7 @@ title: 'Quick Start'
``` ```
</CodeGroup> </CodeGroup>
See the [Agentic ⇒ Vercel AI SDK](/sdks/ai-sdk) docs for more details. See the [AI SDK adapter docs](/sdks/ai-sdk) for usage details.
</Accordion> </Accordion>
<Accordion title="LangChain"> <Accordion title="LangChain">
@ -116,7 +114,7 @@ title: 'Quick Start'
``` ```
</CodeGroup> </CodeGroup>
See the [Agentic ⇒ LangChain](/sdks/langchain) docs for more details. See the [LangChain adapter docs](/sdks/langchain) for usage details.
</Accordion> </Accordion>
<Accordion title="LlamaIndex"> <Accordion title="LlamaIndex">
@ -134,7 +132,7 @@ title: 'Quick Start'
``` ```
</CodeGroup> </CodeGroup>
See the [Agentic ⇒ LlamaIndex](/sdks/llamaindex) docs for more details. See the [LlamaIndex adapter docs](/sdks/llamaindex) for usage details.
</Accordion> </Accordion>
<Accordion title="Firebase Genkit"> <Accordion title="Firebase Genkit">
@ -152,7 +150,7 @@ title: 'Quick Start'
``` ```
</CodeGroup> </CodeGroup>
See the [Agentic ⇒ Genkit](/sdks/genkit) docs for more details. See the [Genkit adapter docs](/sdks/genkit) for usage details.
</Accordion> </Accordion>
<Accordion title="Dexa Dexter"> <Accordion title="Dexa Dexter">
@ -170,7 +168,7 @@ title: 'Quick Start'
``` ```
</CodeGroup> </CodeGroup>
See the [Agentic ⇒ Dexter](/sdks/dexter) docs for more details. See the [Dexter adapter docs](/sdks/dexter) for usage details.
</Accordion> </Accordion>
<Accordion title="OpenAI SDK"> <Accordion title="OpenAI SDK">
@ -190,7 +188,7 @@ title: 'Quick Start'
There's no need for a separate adapter with the OpenAI SDK since all agentic tools are compatible with OpenAI by default. You can use `AIFunctionSet.specs` for function calling or `AIFunctionSet.toolSpecs` for parallel tool calling. There's no need for a separate adapter with the OpenAI SDK since all agentic tools are compatible with OpenAI by default. You can use `AIFunctionSet.specs` for function calling or `AIFunctionSet.toolSpecs` for parallel tool calling.
See the [Agentic ⇒ OpenAI](/sdks/openai) docs for more details. See the [OpenAI adapter docs](/sdks/openai) for usage details.
</Accordion> </Accordion>
</AccordionGroup> </AccordionGroup>
@ -202,7 +200,3 @@ title: 'Quick Start'
</Step> </Step>
</Steps> </Steps>
## Usage
TODO

Wyświetl plik

@ -0,0 +1,77 @@
---
title: Vercel AI SDK
description: Agentic adapter for the Vercel AI SDK.
---
- package: `@agentic/ai-sdk`
- exports: `function createAISDKTools`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/ai-sdk/src/ai-sdk.ts)
- [Vercel AI SDK docs](https://sdk.vercel.ai)
## Install
<CodeGroup>
```bash npm
npm install @agentic/ai-sdk ai
```
```bash yarn
yarn add @agentic/ai-sdk ai
```
```bash pnpm
pnpm add @agentic/ai-sdk ai
```
</CodeGroup>
## Usage
This example also requires you to install `@ai-sdk/openai`.
```ts
import 'dotenv/config'
import { createAISDKTools } from '@agentic/ai-sdk'
import { WeatherClient } from '@agentic/weather'
import { openai } from '@ai-sdk/openai'
import { generateText } from 'ai'
async function main() {
const weather = new WeatherClient()
const result = await generateText({
model: openai('gpt-4o-mini'),
tools: createAISDKTools(weather),
toolChoice: 'required',
temperature: 0,
system: 'You are a helpful assistant. Be as concise as possible.',
prompt: 'What is the weather in San Francisco?'
})
console.log(result.toolResults[0])
}
await main()
```
## Running this example
<Info>
You'll need a free API key from [weatherapi.com](https://www.weatherapi.com)
to run this example. Store it in a local `.env` file as `WEATHER_API_KEY`.
</Info>
<Info>
You'll need an [OpenAI API key](https://platform.openai.com/docs/quickstart)
to run this example. Store it in a local `.env` file as `OPENAI_API_KEY`.
</Info>
```sh
git clone git@github.com:transitive-bullshit/agentic.git
cd agentic
pnpm install
echo 'WEATHER_API_KEY=your-key' >> .env
echo 'OPENAI_API_KEY=your-key' >> .env
npx tsx examples/ai-sdk/bin/weather.ts
```

Wyświetl plik

@ -0,0 +1,75 @@
---
title: Dexter
description: Agentic adapter for the Dexa Dexter SDK.
---
- package: `@agentic/dexter`
- exports: `function createDexterFunctions`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/dexter/src/dexter.ts)
- [Dexa Dexter SDK docs](https://dexter.dexa.ai)
## Install
<CodeGroup>
```bash npm
npm install @agentic/dexter @dexaai/dexter
```
```bash yarn
yarn add @agentic/dexter @dexaai/dexter
```
```bash pnpm
pnpm add @agentic/dexter @dexaai/dexter
```
</CodeGroup>
## Usage
```ts
import 'dotenv/config'
import { createDexterFunctions } from '@agentic/dexter'
import { WeatherClient } from '@agentic/weather'
import { ChatModel, createAIRunner } from '@dexaai/dexter'
async function main() {
const weather = new WeatherClient()
const runner = createAIRunner({
chatModel: new ChatModel({
params: { model: 'gpt-4o-mini', temperature: 0 }
// debug: true
}),
functions: createDexterFunctions(weather),
systemMessage: 'You are a helpful assistant. Be as concise as possible.'
})
const result = await runner('What is the weather in San Francisco?')
console.log(result)
}
await main()
```
## Running this example
<Info>
You'll need a free API key from [weatherapi.com](https://www.weatherapi.com)
to run this example. Store it in a local `.env` file as `WEATHER_API_KEY`.
</Info>
<Info>
You'll need an [OpenAI API key](https://platform.openai.com/docs/quickstart)
to run this example. Store it in a local `.env` file as `OPENAI_API_KEY`.
</Info>
```sh
git clone git@github.com:transitive-bullshit/agentic.git
cd agentic
pnpm install
echo 'WEATHER_API_KEY=your-key' >> .env
echo 'OPENAI_API_KEY=your-key' >> .env
npx tsx examples/dexter/bin/weather.ts
```

Wyświetl plik

@ -0,0 +1,89 @@
---
title: Genkit
description: Agentic adapter for the Firebase Genkit SDK.
---
- package: `@agentic/genkit`
- exports: `function createGenkitTools`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/genkit/src/genkit.ts)
- [Firebase Genkit docs](https://firebase.google.com/docs/genkit)
## Install
<CodeGroup>
```bash npm
npm install @agentic/genkit @genkit-ai/ai @genkit-ai/core
```
```bash yarn
yarn add @agentic/genkit @genkit-ai/ai @genkit-ai/core
```
```bash pnpm
pnpm add @agentic/genkit @genkit-ai/ai @genkit-ai/core
```
</CodeGroup>
## Usage
This example also requires you to install the [genkitx-openai](https://github.com/TheFireCo/genkit-plugins/tree/main/plugins/openai) package, which adds support for OpenAI to Genkit.
```ts
import 'dotenv/config'
import { createGenkitTools } from '@agentic/genkit'
import { WeatherClient } from '@agentic/stdlib'
import { generate } from '@genkit-ai/ai'
import { configureGenkit } from '@genkit-ai/core'
import { gpt4oMini, openAI } from 'genkitx-openai'
async function main() {
const weather = new WeatherClient()
configureGenkit({
plugins: [openAI()]
})
const result = await generate({
model: gpt4oMini,
tools: createGenkitTools(weather),
history: [
{
role: 'system',
content: [
{
text: 'You are a helpful assistant. Be as concise as possible.'
}
]
}
],
prompt: 'What is the weather in San Francisco?'
})
console.log(result)
}
await main()
```
## Running this example
<Info>
You'll need a free API key from [weatherapi.com](https://www.weatherapi.com)
to run this example. Store it in a local `.env` file as `WEATHER_API_KEY`.
</Info>
<Info>
You'll need an [OpenAI API key](https://platform.openai.com/docs/quickstart)
to run this example. Store it in a local `.env` file as `OPENAI_API_KEY`.
</Info>
```sh
git clone git@github.com:transitive-bullshit/agentic.git
cd agentic
pnpm install
echo 'WEATHER_API_KEY=your-key' >> .env
echo 'OPENAI_API_KEY=your-key' >> .env
npx tsx examples/genkit/bin/weather.ts
```

Wyświetl plik

@ -0,0 +1,87 @@
---
title: LangChain
description: Agentic adapter for the LangChain JS SDK.
---
- package: `@agentic/langchain`
- exports: `function createLangChainTools`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/langchain/src/langchain.ts)
- [LangChain JS docs](https://js.langchain.com)
## Install
<CodeGroup>
```bash npm
npm install @agentic/langchain @langchain/core langchain
```
```bash yarn
yarn add @agentic/langchain @langchain/core langchain
```
```bash pnpm
pnpm add @agentic/langchain @langchain/core langchain
```
</CodeGroup>
## Usage
```ts
import { createLangChainTools } from '@agentic/langchain'
import { WeatherClient } from '@agentic/stdlib'
import { ChatPromptTemplate } from '@langchain/core/prompts'
import { ChatOpenAI } from '@langchain/openai'
import { AgentExecutor, createToolCallingAgent } from 'langchain/agents'
async function main() {
const weather = new WeatherClient()
const tools = createLangChainTools(weather)
const agent = createToolCallingAgent({
llm: new ChatOpenAI({ model: 'gpt-4o-mini', temperature: 0 }),
tools,
prompt: ChatPromptTemplate.fromMessages([
['system', 'You are a helpful assistant. Be as concise as possible.'],
['placeholder', '{chat_history}'],
['human', '{input}'],
['placeholder', '{agent_scratchpad}']
])
})
const agentExecutor = new AgentExecutor({
agent,
tools
// verbose: true
})
const result = await agentExecutor.invoke({
input: 'What is the weather in San Francisco?'
})
console.log(result.output)
}
await main()
```
## Running this example
<Info>
You'll need a free API key from [weatherapi.com](https://www.weatherapi.com)
to run this example. Store it in a local `.env` file as `WEATHER_API_KEY`.
</Info>
<Info>
You'll need an [OpenAI API key](https://platform.openai.com/docs/quickstart)
to run this example. Store it in a local `.env` file as `OPENAI_API_KEY`.
</Info>
```sh
git clone git@github.com:transitive-bullshit/agentic.git
cd agentic
pnpm install
echo 'WEATHER_API_KEY=your-key' >> .env
echo 'OPENAI_API_KEY=your-key' >> .env
npx tsx examples/langchain/bin/weather.ts
```

Wyświetl plik

@ -0,0 +1,76 @@
---
title: LlamaIndex
description: Agentic adapter for the LlamaIndex TS SDK.
---
- package: `@agentic/llamaindex`
- exports: `function createLlamaIndexTools`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/llamaindex/src/llamaindex.ts)
- [LlamaIndex TS docs](https://ts.llamaindex.ai)
## Install
<CodeGroup>
```bash npm
npm install @agentic/llamaindex llamaindex
```
```bash yarn
yarn add @agentic/llamaindex llamaindex
```
```bash pnpm
pnpm add @agentic/llamaindex llamaindex
```
</CodeGroup>
## Usage
```ts
import 'dotenv/config'
import { createLlamaIndexTools } from '@agentic/llamaindex'
import { WeatherClient } from '@agentic/stdlib'
import { OpenAI, OpenAIAgent } from 'llamaindex'
async function main() {
const weather = new WeatherClient()
const tools = createLlamaIndexTools(weather)
const agent = new OpenAIAgent({
llm: new OpenAI({ model: 'gpt-4o-mini', temperature: 0 }),
systemPrompt: 'You are a helpful assistant. Be as concise as possible.',
tools
})
const response = await agent.chat({
message: 'What is the weather in San Francisco?'
})
console.log(response.message.content)
}
await main()
```
## Running this example
<Info>
You'll need a free API key from [weatherapi.com](https://www.weatherapi.com)
to run this example. Store it in a local `.env` file as `WEATHER_API_KEY`.
</Info>
<Info>
You'll need an [OpenAI API key](https://platform.openai.com/docs/quickstart)
to run this example. Store it in a local `.env` file as `OPENAI_API_KEY`.
</Info>
```sh
git clone git@github.com:transitive-bullshit/agentic.git
cd agentic
pnpm install
echo 'WEATHER_API_KEY=your-key' >> .env
echo 'OPENAI_API_KEY=your-key' >> .env
npx tsx examples/llamaindex/bin/weather.ts
```

Wyświetl plik

@ -0,0 +1,83 @@
---
title: OpenAI
description: How to use Agentic with the OpenAI TS SDK directly.
---
<Note>
There's no need for an adapter with the OpenAI SDK since all agentic tools are
compatible with OpenAI by default. You can use `AIFunctionSet.specs` for
function calling or `AIFunctionSet.toolSpecs` for parallel tool calling.
</Note>
## Install
<CodeGroup>
```bash npm
npm install @agentic/core @agentic/stdlib openai
```
```bash yarn
yarn add @agentic/core @agentic/stdlib openai
```
```bash pnpm
pnpm add @agentic/core @agentic/stdlib openai
```
</CodeGroup>
## Usage
```ts
import { WeatherClient } from '@agentic/stdlib'
import OpenAI from 'openai'
const weather = new WeatherClient()
const openai = new OpenAI()
const messages: OpenAI.ChatCompletionMessageParam[] = [
{
role: 'system',
content: 'You are a helpful assistant. Be as concise as possible.'
},
{ role: 'user', content: 'What is the weather in San Francisco?' }
]
const res = await openai.chat.completions.create({
messages,
model: 'gpt-4o-mini',
temperature: 0,
tools: weather.functions.toolSpecs,
tool_choice: 'required'
})
const message = res.choices[0]?.message!
console.log(JSON.stringify(message, null, 2))
assert(message.tool_calls?.[0]?.function?.name === 'get_current_weather')
const fn = weather.functions.get('get_current_weather')!
const toolParams = message.tool_calls[0].function.arguments
const toolResult = await fn(toolParams)
console.log(JSON.stringify(toolResult, null, 2))
```
## Running this example
<Info>
You'll need a free API key from [weatherapi.com](https://www.weatherapi.com)
to run this example. Store it in a local `.env` file as `WEATHER_API_KEY`.
</Info>
<Info>
You'll need an [OpenAI API key](https://platform.openai.com/docs/quickstart)
to run this example. Store it in a local `.env` file as `OPENAI_API_KEY`.
</Info>
```sh
git clone git@github.com:transitive-bullshit/agentic.git
cd agentic
pnpm install
echo 'WEATHER_API_KEY=your-key' >> .env
echo 'OPENAI_API_KEY=your-key' >> .env
npx tsx examples/openai/bin/weather.ts
```

Wyświetl plik

@ -7,7 +7,7 @@ description: Bing web search API client.
- exports: `class BingClient`, `namespace bing` - exports: `class BingClient`, `namespace bing`
- env vars: `BING_API_KEY` - env vars: `BING_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/bing/src/bing-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/bing/src/bing-client.ts)
- [api docs](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api) - [bing web search docs](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: A simple calculator tool.
- exports: `function calculator` - exports: `function calculator`
- env vars: _none_ - env vars: _none_
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/calculator/src/calculator.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/calculator/src/calculator.ts)
- [api docs](https://mathjs.org) - [mathjs docs](https://mathjs.org)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Resolving and enriching people and company data.
- exports: `class ClearbitClient`, `namespace clearbit` - exports: `class ClearbitClient`, `namespace clearbit`
- env vars: `CLEARBIT_API_KEY` - env vars: `CLEARBIT_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/clearbit/src/clearbit-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/clearbit/src/clearbit-client.ts)
- [api docs](https://dashboard.clearbit.com/docs) - [clearbit api docs](https://dashboard.clearbit.com/docs)
## Install ## Install

Wyświetl plik

@ -9,7 +9,7 @@ Diffbot provides web page classification and scraping. It also provides access t
- exports: `class DiffbotClient`, `namespace diffbot` - exports: `class DiffbotClient`, `namespace diffbot`
- env vars: `DIFFBOT_API_KEY` - env vars: `DIFFBOT_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/diffbot/src/diffbot-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/diffbot/src/diffbot-client.ts)
- [api docs](https://docs.diffbot.com) - [diffbot api docs](https://docs.diffbot.com)
## Install ## Install

Wyświetl plik

@ -9,7 +9,7 @@ Hosted Python code intrepreter sandbox which is really useful for data analysis,
- exports: `function e2b` - exports: `function e2b`
- env vars: `E2B_API_KEY` - env vars: `E2B_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/e2b/src/e2b.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/e2b/src/e2b.ts)
- [api docs](https://e2b.dev) - [e2b api docs](https://e2b.dev)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Web search tailored for LLMs.
- exports: `class ExaClient`, `namespace exa` - exports: `class ExaClient`, `namespace exa`
- env vars: `EXA_API_KEY` - env vars: `EXA_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/exa/src/exa-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/exa/src/exa-client.ts)
- [api docs](https://docs.exa.ai) - [exa api docs](https://docs.exa.ai)
## Install ## Install

Wyświetl plik

@ -9,7 +9,7 @@ Turn websites into LLM-ready data. Crawl and convert any website into clean mark
- exports: `class FirecrawlClient`, `namespace firecrawl` - exports: `class FirecrawlClient`, `namespace firecrawl`
- env vars: `FIRECRAWL_API_KEY` - env vars: `FIRECRAWL_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/firecrawl/src/firecrawl-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/firecrawl/src/firecrawl-client.ts)
- [api docs](https://www.firecrawl.dev) - [firecrawl api docs](https://www.firecrawl.dev)
## Install ## Install

Wyświetl plik

@ -9,7 +9,7 @@ Note that the [HN Algolia API](https://hn.algolia.com/api) seems to no longer be
- exports: `class HackerNewsClient`, `namespace hackernews` - exports: `class HackerNewsClient`, `namespace hackernews`
- env vars: `HACKER_NEWS_API_USER_AGENT` (_optional_) - env vars: `HACKER_NEWS_API_USER_AGENT` (_optional_)
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/hacker-news/src/hacker-news-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/hacker-news/src/hacker-news-client.ts)
- [api docs](https://github.com/HackerNews/API) - [HN api docs](https://github.com/HackerNews/API)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Email finder, verifier, and enrichment.
- exports: `class HunterClient`, `namespace hunter` - exports: `class HunterClient`, `namespace hunter`
- env vars: `HUNTER_API_KEY` - env vars: `HUNTER_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/hunter/src/hunter-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/hunter/src/hunter-client.ts)
- [api docs]() - [hunter api docs](https://hunter.io/api)
## Install ## Install

Wyświetl plik

@ -9,7 +9,7 @@ LLM-friendly URL reader and search client by [Jina AI](https://jina.ai/reader) w
- exports: `class JinaClient`, `namespace jina` - exports: `class JinaClient`, `namespace jina`
- env vars: `JINA_API_KEY` - env vars: `JINA_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/jina/src/jina-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/jina/src/jina-client.ts)
- [api docs](https://jina.ai/reader) - [jina api docs](https://jina.ai/reader)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Unofficial Midjourney API client for generative images.
- exports: `class MidjourneyClient`, `namespace midjourney` - exports: `class MidjourneyClient`, `namespace midjourney`
- env vars: `MIDJOURNEY_IMAGINE_API_KEY` - env vars: `MIDJOURNEY_IMAGINE_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/midjourney/src/midjourney-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/midjourney/src/midjourney-client.ts)
- [api docs](https://www.imagineapi.dev) - [imagine api docs](https://www.imagineapi.dev)
## Install ## Install

Wyświetl plik

@ -9,7 +9,7 @@ The [Novu API](https://novu.co) provides a router for sending notifications acro
- exports: `class NovuClient`, `namespace novu` - exports: `class NovuClient`, `namespace novu`
- env vars: `NOVU_API_KEY` - env vars: `NOVU_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/novu/src/novu-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/novu/src/novu-client.ts)
- [api docs](https://novu.co) - [novu api docs](https://novu.co)
## Install ## Install

Wyświetl plik

@ -12,7 +12,7 @@ description: People & company data enrichment.
- exports: `class PeopleDataLabsClient`, `namespace peopledatalabs` - exports: `class PeopleDataLabsClient`, `namespace peopledatalabs`
- env vars: `PEOPLE_DATA_LABS_API_KEY` - env vars: `PEOPLE_DATA_LABS_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/people-data-labs/src/people-data-labs-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/people-data-labs/src/people-data-labs-client.ts)
- [api docs](https://www.peopledatalabs.com) - [people data labs api docs](https://www.peopledatalabs.com)
## Install ## Install

Wyświetl plik

@ -13,7 +13,7 @@ Real-time news API and web content data from 140,000+ sources. Structured and en
- exports: `class PerigonClient`, `namespace perigon` - exports: `class PerigonClient`, `namespace perigon`
- env vars: `PERIGON_API_KEY` - env vars: `PERIGON_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/perigon/src/perigon-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/perigon/src/perigon-client.ts)
- [api docs](https://www.goperigon.com/products/news-api) - [perigon api docs](https://www.goperigon.com/products/news-api)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Stock market and company financial data.
- exports: `class PolygonClient`, `namespace polygon` - exports: `class PolygonClient`, `namespace polygon`
- env vars: `POLYGON_API_KEY` - env vars: `POLYGON_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/polygon/src/polygon-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/polygon/src/polygon-client.ts)
- [api docs](https://polygon.io/docs) - [polygon api docs](https://polygon.io/docs)
## Install ## Install

Wyświetl plik

@ -9,7 +9,7 @@ In-depth company data, including signals like fundraising announcemnts, hiring i
- exports: `class PredictLeadsClient`, `namespace predictleads` - exports: `class PredictLeadsClient`, `namespace predictleads`
- env vars: `PREDICT_LEADS_API_KEY`, `PREDICT_LEADS_API_TOKEN` - env vars: `PREDICT_LEADS_API_KEY`, `PREDICT_LEADS_API_TOKEN`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/predict-leads/src/predict-leads-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/predict-leads/src/predict-leads-client.ts)
- [api docs]() - [precit leads api docs](https://docs.predictleads.com/v3)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: People and company data from LinkedIn & Crunchbase.
- exports: `class ProxycurlClient`, `namespace proxycurl` - exports: `class ProxycurlClient`, `namespace proxycurl`
- env vars: `PROXYCURL_API_KEY` - env vars: `PROXYCURL_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/proxycurl/src/proxycurl-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/proxycurl/src/proxycurl-client.ts)
- [api docs](https://nubela.co/proxycurl) - [proxycurl api docs](https://nubela.co/proxycurl)
## Install ## Install

Wyświetl plik

@ -27,7 +27,7 @@ The most important search engines are:
- exports: `class SearxngClient`, `namespace searxng` - exports: `class SearxngClient`, `namespace searxng`
- env vars: `SEARXNG_API_BASE_URL` - env vars: `SEARXNG_API_BASE_URL`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/searxng/src/searxng-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/searxng/src/searxng-client.ts)
- [api docs](https://docs.searxng.org) - [searxng api docs](https://docs.searxng.org)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Lightweight wrapper around SerpAPI for Google search.
- exports: `class SerpAPIClient`, `namespace serpapi` - exports: `class SerpAPIClient`, `namespace serpapi`
- env vars: `SERPAPI_API_KEY` - env vars: `SERPAPI_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/serpapi/src/serpapi-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/serpapi/src/serpapi-client.ts)
- [api docs](https://serpapi.com/search-api) - [serpapi api docs](https://serpapi.com/search-api)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Lightweight wrapper around Serper for Google search.
- exports: `class SerperClient`, `namespace serper` - exports: `class SerperClient`, `namespace serper`
- env vars: `SERPER_API_KEY` - env vars: `SERPER_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/serper/src/serper-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/serper/src/serper-client.ts)
- [api docs](https://serper.dev) - [serper api docs](https://serper.dev)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Minimal Slack API client for sending and receiving Slack messages.
- exports: `class SlackClient`, `namespace slack` - exports: `class SlackClient`, `namespace slack`
- env vars: `SLACK_API_KEY` - env vars: `SLACK_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/slack/src/slack-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/slack/src/slack-client.ts)
- [api docs]() - [slack api docs](https://api.slack.com/docs)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Unofficial Twitter / X client (readonly) which is much cheaper than
- exports: `class SocialDataClient`, `namespace socialdata` - exports: `class SocialDataClient`, `namespace socialdata`
- env vars: `SOCIAL_DATA_API_KEY` - env vars: `SOCIAL_DATA_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/social-data/src/social-data-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/social-data/src/social-data-client.ts)
- [api docs](https://socialdata.tools) - [social data tools api docs](https://socialdata.tools)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Web search API tailored for LLMs.
- exports: `class TavilyClient`, `namespace tavily` - exports: `class TavilyClient`, `namespace tavily`
- env vars: `BING_API_KEY` - env vars: `BING_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/tavily/src/tavily-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/tavily/src/tavily-client.ts)
- [api docs](https://tavily.com) - [tavily api docs](https://tavily.com)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Twilio conversation API to send and receive SMS messages.
- exports: `class TwilioClient`, `namespace twilio` - exports: `class TwilioClient`, `namespace twilio`
- env vars: `TWILIO_API_KEY` - env vars: `TWILIO_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/twilio/src/twilio-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/twilio/src/twilio-client.ts)
- [api docs](https://www.twilio.com/docs/conversations/api) - [twilio api docs](https://www.twilio.com/docs/conversations/api)
## Install ## Install

Wyświetl plik

@ -9,7 +9,7 @@ Basic Twitter API methods for fetching users, tweets, and searching recent tweet
- exports: `class TwitterClient`, `namespace twitter` - exports: `class TwitterClient`, `namespace twitter`
- env vars: `TWITTER_API_KEY`, `TWITTER_API_PLAN` - env vars: `TWITTER_API_KEY`, `TWITTER_API_PLAN`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/twitter/src/twitter-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/twitter/src/twitter-client.ts)
- [api docs](https://developer.twitter.com/en/docs/twitter-api) - [twitter api docs](https://developer.twitter.com/en/docs/twitter-api)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Simple Weather API client for accessing weather data based on locat
- exports: `class WeatherClient`, `namespace weather` - exports: `class WeatherClient`, `namespace weather`
- env vars: `WEATHER_API_KEY` - env vars: `WEATHER_API_KEY`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/weather/src/weather-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/weather/src/weather-client.ts)
- [api docs](https://www.weatherapi.com) - [weatherapi.com api docs](https://www.weatherapi.com)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Basic Wikidata client.
- exports: `class WikidataClient`, `namespace wikidata` - exports: `class WikidataClient`, `namespace wikidata`
- env vars: `WIKIDATA_API_USER_AGENT` (_optional_) - env vars: `WIKIDATA_API_USER_AGENT` (_optional_)
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/wikidata/src/wikidata-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/wikidata/src/wikidata-client.ts)
- [api docs](https://github.com/maxlath/wikibase-sdk) - [wikibase api docs](https://github.com/maxlath/wikibase-sdk)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Wikipedia apage search and summary API.
- exports: `class WikipediaClient`, `namespace wikipedia` - exports: `class WikipediaClient`, `namespace wikipedia`
- env vars: `WIKIPEDIA_API_USER_AGENT` (_optional_) - env vars: `WIKIPEDIA_API_USER_AGENT` (_optional_)
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/wikipedia/src/wikipedia-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/wikipedia/src/wikipedia-client.ts)
- [api docs](https://www.mediawiki.org/wiki/API) - [wikipedia api docs](https://www.mediawiki.org/wiki/API)
## Install ## Install

Wyświetl plik

@ -7,7 +7,7 @@ description: Wolfram Alpha LLM API client for answering computational, mathemati
- exports: `class WolframAlphaClient`, `namespace wolframalpha` - exports: `class WolframAlphaClient`, `namespace wolframalpha`
- env vars: `WOLFRAM_APP_ID` - env vars: `WOLFRAM_APP_ID`
- [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/wolfram-alpha/src/wolfram-alpha-client.ts) - [source](https://github.com/transitive-bullshit/agentic/blob/main/packages/wolfram-alpha/src/wolfram-alpha-client.ts)
- [api docs](https://products.wolframalpha.com/llm-api/documentation) - [wolfram alpha api docs](https://products.wolframalpha.com/llm-api/documentation)
## Install ## Install

124
docs/usage.mdx 100644
Wyświetl plik

@ -0,0 +1,124 @@
---
title: Usage
---
## AI SDKs
<CardGroup cols={2}>
<Card title='Vercel AI SDK' href='/sdks/ai-sdk'>
Using Agentic with the Vercel AI SDK.
</Card>
<Card title='LangChain' href='/sdks/langchain'>
Using Agentic with LangChain.
</Card>
<Card title='LlamaIndex' href='/sdks/llamaindex'>
Using Agentic with LlamaIndex.
</Card>
<Card title='Firebase Genkit' href='/sdks/genkit'>
Using Agentic with Genkit.
</Card>
<Card title='Dexa Dexter' href='/sdks/dexter'>
Using Agentic with Dexter.
</Card>
<Card title='OpenAI' href='/sdks/openai'>
Using Agentic with OpenAI directly.
</Card>
</CardGroup>
## Tools
### TS Tool Usage
Agentic clients like `WeatherClient` can be used as normal TS classes:
```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 Tool Usage
Or you can use these clients as **LLM-based tools** where the LLM decides when and how to invoke the underlying functions for you.
This works across all of the major AI SDKs via adapters. Here's an example using [Vercel's AI SDK](https://github.com/vercel/ai):
```ts
// 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])
```
You can use our standard library of thoroughly tested AI functions with your favorite AI SDK – without having to write any glue code!
### Multiple Tool Usage via AIFunctionLike
Here's a slightly more complex example which uses multiple clients and selects a subset of their functions using the `AIFunctionSet.pick` method:
```ts
// 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)
}
```
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).
All of the SDK adapters like `createDexterFunctions` accept very flexible `AIFunctionLike` objects, which include:
- `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`)
- `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)
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.

Wyświetl plik

@ -41,7 +41,6 @@
"eslint": "^8.57.0", "eslint": "^8.57.0",
"husky": "^9.1.4", "husky": "^9.1.4",
"lint-staged": "^15.2.9", "lint-staged": "^15.2.9",
"mintlify": "^4.0.203",
"npm-run-all2": "^6.2.2", "npm-run-all2": "^6.2.2",
"only-allow": "^1.2.1", "only-allow": "^1.2.1",
"prettier": "^3.3.3", "prettier": "^3.3.3",

Plik diff jest za duży Load Diff

Wyświetl plik

@ -150,7 +150,7 @@ import { WeatherClient } from '@agentic/weather'
### AI SDKs ### AI SDKs
To use Agentic with one of the supported AI SDKs, you'll also need to install its (_really lightweight_) adapter package. To use Agentic with one of the supported AI SDKs, you'll also need to install its corresponding adapter package.
#### Vercel AI SDk #### Vercel AI SDk