Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix helloWorld.ts example for latest Anthropic SDK

James Murdza17a00099194a
diff --git a/apps/web/src/app/(docs)/docs/hello-world/js/page.mdx b/apps/web/src/app/(docs)/docs/hello-world/js/page.mdx
index 0e650b5ef..9d71e345a 100644
--- a/apps/web/src/app/(docs)/docs/hello-world/js/page.mdx
+++ b/apps/web/src/app/(docs)/docs/hello-world/js/page.mdx
@@ -51,7 +51,7 @@ Usually, all you need from the model is just support for tool use. If the LLM do
Create the `model.ts` file and paste the following code.
<CodeGroup isFileName title="model.ts" isRunnable={false}>
```ts
-import { Tool } from '@anthropic-ai/sdk/src/resources/beta/tools'
+import { Anthropic } from '@anthropic-ai/sdk'
export const MODEL_NAME = 'claude-3-opus-20240229'
@@ -67,7 +67,7 @@ you are a python data scientist. you are given tasks to complete and you run pyt
- you can run any python code you want, everything is running in a secure sandbox environment.
`
-export const tools: Tool[] = [
+export const tools: Anthropic.Tool[] = [
{
name: 'execute_python',
description: 'Execute python code in a Jupyter notebook cell and returns any result, stdout, stderr, display_data, and error.',
@@ -166,7 +166,7 @@ const anthropic = new Anthropic()
async function chat(codeInterpreter: CodeInterpreter, userMessage: string): Promise<Execution | undefined> {
console.log('Waiting for Claude...')
- const msg = await anthropic.beta.tools.messages.create({
+ const msg = await anthropic.messages.create({
model: MODEL_NAME,
system: SYSTEM_PROMPT,
max_tokens: 4096,
@@ -305,4 +305,4 @@ The chart got saved in the `chart.png` file and it should look similar to this:
className="rounded w-full"
alt="Chart visualizing distribution height of men"
unoptimized
-/>
\ No newline at end of file
+/>