Skip to content

Commit

Permalink
docs: improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Aug 17, 2024
1 parent 9296e75 commit e65a0e6
Show file tree
Hide file tree
Showing 42 changed files with 734 additions and 3,164 deletions.
4 changes: 2 additions & 2 deletions docs/intro.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: 'Agentic'
description: 'AI agent stdlib that works with any LLM and TypeScript AI SDK.'
title: Intro
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**.
Expand Down
23 changes: 10 additions & 13 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,17 @@
"navigation": [
{
"group": "Getting Started",
"pages": ["intro", "quickstart", "usage"]
},
{
"group": "AI SDKs",
"pages": [
"intro",
"quickstart",
"usage",
{
"group": "AI SDKs",
"pages": [
"sdks/ai-sdk",
"sdks/langchain",
"sdks/llamaindex",
"sdks/genkit",
"sdks/dexter"
]
}
"sdks/ai-sdk",
"sdks/langchain",
"sdks/llamaindex",
"sdks/genkit",
"sdks/dexter",
"sdks/openai"
]
},
{
Expand Down
28 changes: 11 additions & 17 deletions docs/quickstart.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
---
title: 'Quick Start'
title: Quick Start
---

## Install

<Info>
**Prerequisite**: All Agentic packages are [ESM
only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
Expand Down Expand Up @@ -52,19 +50,19 @@ title: 'Quick Start'
<Accordion title="Install individual AI 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>
```bash npm
npm install @agentic/calculator
npm install @agentic/weather
```

```bash yarn
yarn add @agentic/calculator
yarn add @agentic/weather
```

```bash pnpm
pnpm add @agentic/calculator
pnpm add @agentic/weather
```
</CodeGroup>
</Accordion>
Expand Down Expand Up @@ -98,7 +96,7 @@ title: 'Quick Start'
```
</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 title="LangChain">
Expand All @@ -116,7 +114,7 @@ title: 'Quick Start'
```
</CodeGroup>

See the [Agentic ⇒ LangChain](/sdks/langchain) docs for more details.
See the [LangChain adapter docs](/sdks/langchain) for usage details.
</Accordion>

<Accordion title="LlamaIndex">
Expand All @@ -134,7 +132,7 @@ title: 'Quick Start'
```
</CodeGroup>

See the [Agentic ⇒ LlamaIndex](/sdks/llamaindex) docs for more details.
See the [LlamaIndex adapter docs](/sdks/llamaindex) for usage details.
</Accordion>

<Accordion title="Firebase Genkit">
Expand All @@ -152,7 +150,7 @@ title: 'Quick Start'
```
</CodeGroup>

See the [Agentic ⇒ Genkit](/sdks/genkit) docs for more details.
See the [Genkit adapter docs](/sdks/genkit) for usage details.
</Accordion>

<Accordion title="Dexa Dexter">
Expand All @@ -170,7 +168,7 @@ title: 'Quick Start'
```
</CodeGroup>

See the [Agentic ⇒ Dexter](/sdks/dexter) docs for more details.
See the [Dexter adapter docs](/sdks/dexter) for usage details.
</Accordion>

<Accordion title="OpenAI SDK">
Expand All @@ -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.

See the [Agentic ⇒ OpenAI](/sdks/openai) docs for more details.
See the [OpenAI adapter docs](/sdks/openai) for usage details.
</Accordion>

</AccordionGroup>
Expand All @@ -202,7 +200,3 @@ title: 'Quick Start'
</Step>

</Steps>

## Usage

TODO
77 changes: 77 additions & 0 deletions docs/sdks/ai-sdk.mdx
Original file line number Diff line number Diff line change
@@ -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 [email protected]: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
```
75 changes: 75 additions & 0 deletions docs/sdks/dexter.mdx
Original file line number Diff line number Diff line change
@@ -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 [email protected]: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
```
89 changes: 89 additions & 0 deletions docs/sdks/genkit.mdx
Original file line number Diff line number Diff line change
@@ -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 [email protected]: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
```
Loading

0 comments on commit e65a0e6

Please sign in to comment.