Skip to content

Commit 36e13af

Browse files
committed
docs(readme): reorganise structure and add new integration examples
Reorganise README for improved readability and discoverability: - Move Development Environment section to the bottom - Convert integrations to collapsible details sections - Add Anthropic Claude integration with toAnthropic() usage - Add OpenAI Responses API integration with toOpenAIResponses() - Include installation commands within each integration section - Add bun as a package manager option throughout - Remove separate "Optional: AI SDK Integration" section The collapsible sections reduce visual clutter while keeping all integration documentation easily accessible. Each integration now includes its required dependencies inline.
1 parent e131433 commit 36e13af

1 file changed

Lines changed: 103 additions & 31 deletions

File tree

README.md

Lines changed: 103 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,48 +21,94 @@ yarn add @stackone/ai
2121

2222
# Using pnpm
2323
pnpm add @stackone/ai
24+
25+
# Using bun
26+
bun add @stackone/ai
2427
```
2528

26-
### Optional: AI SDK Integration
29+
## Integrations
30+
31+
The StackOneToolSet makes it super easy to use StackOne APIs as tools in your AI applications.
2732

28-
If you plan to use the AI SDK integration (Vercel AI SDK), install it separately:
33+
<details>
34+
<summary><strong>With OpenAI Chat Completions API</strong></summary>
2935

3036
```bash
31-
# Using npm
32-
npm install ai
37+
npm install openai # or: yarn add openai / pnpm add openai / bun add openai
38+
```
3339

34-
# Using yarn
35-
yarn add ai
40+
```typescript
41+
import { OpenAI } from "openai";
42+
import { StackOneToolSet } from "@stackone/ai";
3643

37-
# Using pnpm
38-
pnpm add ai
44+
const toolset = new StackOneToolSet({
45+
baseUrl: "https://api.stackone.com",
46+
accountId: "your-account-id",
47+
});
48+
49+
const tools = await toolset.fetchTools();
50+
51+
await openai.chat.completions.create({
52+
model: "gpt-5.1",
53+
messages: [
54+
{
55+
role: "system",
56+
content: "You are a helpful HR assistant using BambooHR.",
57+
},
58+
{
59+
role: "user",
60+
content: "Create a time-off request for employee id cxIQ5764hj2",
61+
},
62+
],
63+
tools: tools.toOpenAI(),
64+
});
3965
```
4066

41-
## Development Environment
67+
[View full example](examples/openai-integration.ts)
4268

43-
### Using Nix Flake
69+
</details>
4470

45-
This project includes a Nix flake for reproducible development environments. If you have Nix installed with flakes enabled, you can use it to set up your development environment:
71+
<details>
72+
<summary><strong>With OpenAI Responses API</strong></summary>
4673

4774
```bash
48-
# Enter development shell
49-
nix develop
75+
npm install openai # or: yarn add openai / pnpm add openai / bun add openai
76+
```
5077

51-
# Or use direnv for automatic activation
52-
echo "use flake" > .envrc
53-
direnv allow
78+
```typescript
79+
import OpenAI from "openai";
80+
import { StackOneToolSet } from "@stackone/ai";
81+
82+
const toolset = new StackOneToolSet({
83+
baseUrl: "https://api.stackone.com",
84+
accountId: "your-account-id",
85+
});
86+
87+
const tools = await toolset.fetchTools();
88+
89+
const openai = new OpenAI();
90+
91+
await openai.responses.create({
92+
model: "gpt-5.1",
93+
instructions: "You are a helpful HR assistant.",
94+
input: "What is the phone number for employee c28xIQ?",
95+
tools: tools.toOpenAIResponses(),
96+
});
5497
```
5598

56-
The flake provides all necessary development dependencies including Node.js, pnpm, and other build tools.
99+
[View full example](examples/openai-responses-integration.ts)
57100

58-
## Integrations
101+
</details>
59102

60-
The StackOneToolSet makes it super easy to use StackOne APIs as tools in your AI applications.
103+
<details>
104+
<summary><strong>With Anthropic Claude</strong></summary>
61105

62-
### With OpenAI library
106+
```bash
107+
npm install @anthropic-ai/sdk # or: yarn/pnpm/bun add @anthropic-ai/sdk
108+
```
63109

64110
```typescript
65-
import { OpenAI } from "openai";
111+
import Anthropic from "@anthropic-ai/sdk";
66112
import { StackOneToolSet } from "@stackone/ai";
67113

68114
const toolset = new StackOneToolSet({
@@ -72,25 +118,32 @@ const toolset = new StackOneToolSet({
72118

73119
const tools = await toolset.fetchTools();
74120

75-
await openai.chat.completions.create({
76-
model: "gpt-5.1",
121+
const anthropic = new Anthropic();
122+
123+
await anthropic.messages.create({
124+
model: "claude-haiku-4-5-20241022",
125+
max_tokens: 1024,
126+
system: "You are a helpful HR assistant.",
77127
messages: [
78-
{
79-
role: "system",
80-
content: "You are a helpful HR assistant using BambooHR.",
81-
},
82128
{
83129
role: "user",
84-
content: "Create a time-off request for employee id cxIQ5764hj2",
130+
content: "What is the phone number for employee c28xIQ?",
85131
},
86132
],
87-
tools: tools.toOpenAI(),
133+
tools: tools.toAnthropic(),
88134
});
89135
```
90136

91-
[View full example](examples/openai-integration.ts)
137+
[View full example](examples/anthropic-integration.ts)
138+
139+
</details>
140+
141+
<details>
142+
<summary><strong>With AI SDK by Vercel</strong></summary>
92143

93-
### AI SDK by Vercel
144+
```bash
145+
npm install ai @ai-sdk/openai # or: yarn/pnpm/bun add ai @ai-sdk/openai
146+
```
94147

95148
```typescript
96149
import { openai } from "@ai-sdk/openai";
@@ -113,6 +166,8 @@ await generateText({
113166

114167
[View full example](examples/ai-sdk-integration.ts)
115168

169+
</details>
170+
116171
## Usage
117172

118173
```typescript
@@ -436,3 +491,20 @@ When AI agents use this tool, they will:
436491
5. **Report results**: Show which accounts received the feedback successfully
437492

438493
The tool description includes clear instructions for AI agents to always ask for explicit user consent before submitting feedback.
494+
495+
## Development Environment
496+
497+
### Using Nix Flake
498+
499+
This project includes a Nix flake for reproducible development environments. If you have Nix installed with flakes enabled, you can use it to set up your development environment:
500+
501+
```bash
502+
# Enter development shell
503+
nix develop
504+
505+
# Or use direnv for automatic activation
506+
echo "use flake" > .envrc
507+
direnv allow
508+
```
509+
510+
The flake provides all necessary development dependencies including Node.js, pnpm, and other build tools.

0 commit comments

Comments
 (0)