Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Finalize hello world for Python

Vasek Mlejnsky121b928ad2cb
diff --git a/apps/docs/src/app/hello-world/py/page.mdx b/apps/docs/src/app/hello-world/py/page.mdx
index d8dc8d4eb..e767dda5d 100644
--- a/apps/docs/src/app/hello-world/py/page.mdx
+++ b/apps/docs/src/app/hello-world/py/page.mdx
@@ -3,7 +3,7 @@ import imgChart from '@/images/hello-world-chart.png'
# Hello World
-This short Python guide will show you basics of E2B:
+This Python guide will show you basics of E2B:
- Connect the code interpreter to an LLM
- Prompt the LLM to generate the Python code
- Execute the AI-generated Python code in a secure E2B sandbox
@@ -139,10 +139,12 @@ Create the `main.py` file, import dependencies, and create the `chat()` function
<CodeGroup isFileName title="main.py" isRunnable={false}>
```python {{ language: 'python' }}
+import base64
from dotenv import load_dotenv
from anthropic import Anthropic
-from typing import List
+from typing import List, Tuple
from e2b_code_interpreter import CodeInterpreter, Result
+from e2b_code_interpreter.models import Logs
from e2b_hello_world.model import MODEL_NAME, SYSTEM_PROMPT, tools
from e2b_hello_world.code_interpreter import code_interpret
@@ -152,7 +154,7 @@ load_dotenv()
client = Anthropic()
-def chat(code_interpreter: CodeInterpreter, user_message: str) -> List[Result]:
+def chat(code_interpreter: CodeInterpreter, user_message: str) -> Tuple[List[Result], Logs]:
print(f"\n{'='*50}\nUser Message: {user_message}\n{'='*50}")
message = client.beta.tools.messages.create(
diff --git a/apps/docs/src/components/Navigation/routes.tsx b/apps/docs/src/components/Navigation/routes.tsx
index 795d434e2..7da57c115 100644
--- a/apps/docs/src/components/Navigation/routes.tsx
+++ b/apps/docs/src/components/Navigation/routes.tsx
@@ -28,6 +28,10 @@ import {
Wrench,
} from 'lucide-react'
+import Image from 'next/image'
+import logoNode from '@/images/logos/node.svg'
+import logoPython from '@/images/logos/python.svg'
+
export const routes = [
{
title: 'Getting Started',
@@ -39,11 +43,13 @@ export const routes = [
{
title: 'helloWorld.[js|ts]',
href: '/hello-world/js',
+ icon: <Image src={logoNode} width={20} height={20} alt="Python logo" />,
isFontMono: true,
},
{
title: 'hello_world.py',
href: '/hello-world/py',
+ icon: <Image src={logoPython} width={20} height={20} alt="Python logo" />,
isFontMono: true,
},
{