Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 7
feat: add Anthropic Claude integration#208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
0dbbd497ced47d4681f9eb4ea0c5a00e8a3666f246bfc0a6882064e0b4cc8f9File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /** | ||
| * This example shows how to use StackOne tools with Anthropic Claude. | ||
| */ | ||
| import assert from 'node:assert'; | ||
| import process from 'node:process'; | ||
| import Anthropic from '@anthropic-ai/sdk'; | ||
| import { StackOneToolSet } from '@stackone/ai'; | ||
| const apiKey = process.env.STACKONE_API_KEY; | ||
| if (!apiKey) { | ||
| console.error('STACKONE_API_KEY environment variable is required'); | ||
| process.exit(1); | ||
| } | ||
| // Replace with your actual account ID from StackOne dashboard | ||
| const accountId = 'your-hris-account-id'; | ||
| const anthropicIntegration = async (): Promise<void> => { | ||
| // Initialise StackOne | ||
| const toolset = new StackOneToolSet({ | ||
| accountId, | ||
| baseUrl: process.env.STACKONE_BASE_URL ?? 'https://api.stackone.com', | ||
| }); | ||
| // Filter for any relevant tools | ||
| const tools = await toolset.fetchTools({ | ||
| actions: ['*_list_*', '*_search_*'], | ||
| }); | ||
| const anthropicTools = tools.toAnthropic(); | ||
| // Initialise Anthropic client | ||
| const anthropic = new Anthropic(); | ||
| // Create a message with tool calls | ||
| const response = await anthropic.messages.create({ | ||
| model: 'claude-haiku-4-5-20241022', | ||
| max_tokens: 1024, | ||
| system: 'You are a helpful assistant that can access tools.', | ||
| messages: [ | ||
| { | ||
| role: 'user', | ||
| content: 'What is the employee with id: c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA phone number?', | ||
| }, | ||
| ], | ||
| tools: anthropicTools, | ||
| }); | ||
| // Verify the response contains tool use | ||
| assert(response.content.length > 0, 'Expected at least one content block in the response'); | ||
| const toolUseBlock = response.content.find((block) => block.type === 'tool_use'); | ||
| assert(toolUseBlock !== undefined, 'Expected a tool_use block in the response'); | ||
| assert(toolUseBlock.type === 'tool_use', 'Expected block to be tool_use type'); | ||
| assert(toolUseBlock.name === 'hris_get_employee', 'Expected tool call to be hris_get_employee'); | ||
| // Verify the input contains the expected fields | ||
| const input = toolUseBlock.input as Record<string, unknown>; | ||
| assert(input.id === 'c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA', 'Expected id to match the query'); | ||
| }; | ||
| // Run the example | ||
| await anthropicIntegration(); | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
CopilotAIDec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The model name
claude-haiku-4-5-20241022appears to be incorrect. Based on Anthropic's model naming conventions, this should likely beclaude-3-5-haiku-20241022(Claude 3.5 Haiku from October 2024). There is no publicly documented Claude 4 or Claude 4.5 model as of the knowledge cutoff.