Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
openai integration [wip]
Vasek Mlejnsky6eb12170c4bf
diff --git a/apps/docs/src/app/llm-platforms/openai/page.mdx b/apps/docs/src/app/llm-platforms/openai/page.mdxnew file mode 100644index 000000000..0eacccc84--- /dev/null+++ b/apps/docs/src/app/llm-platforms/openai/page.mdx@@ -0,0 +1,44 @@+# OpenAI++E2B offers a native support for OpenAI's new [Assistants API](https://platform.openai.com/docs/assistants/overview).++<Note>+The Assistants API allows you to build AI assistants within your own applications. An Assistant has instructions and can leverage models, tools, and knowledge to respond to user queries. The Assistants API currently supports three types of tools: Code Interpreter, Retrieval, and Function calling.+</Note>++You can use E2B's sandbox as an environment for the tool execution for your AI assistant. The specific feature of OpenAI's Assistants that we'll take advantage of is the [Function calling](https://platform.openai.com/docs/assistants/tools/function-calling).+This way you can let the AI assistant to for example download files, use custom cloud browser, use terminal, write, run, and debug code, and more.++## Python Usage++<Note>+[TODO] See the repository with code here.+</Note>++### Import E2B and created the sandbox+<CodeGroup>+```py+from e2b import Sandbox # $HighlightLine+import openai++sbx = Sandbox() # $HighlightLine+```+</CodeGroup>++### Define assistant's actions+We're using the `sandbox.action()` decorator to mark our function as an assistant action. An assistant action is a function that the AI assistant can use to complete its task.+It can be pretty much anything you want - running code, downloading files, analyzing data, for for example running a terminal command.++Our action here is simple. It takes two arguments - `path` and `content` - then it writes the `content` to a file on the `path` inside the sandbox.+<CodeGroup>+```py+def write_to_file(path, content):+ sbx.filesystem.write(path, content)+```+</CodeGroup>++### Let assistant perform actions+Now inside the++## JavaScript Usagediff --git a/apps/docs/src/components/Navigation/routes.tsx b/apps/docs/src/components/Navigation/routes.tsxindex 323563107..04e9303f8 100644--- a/apps/docs/src/components/Navigation/routes.tsx+++ b/apps/docs/src/components/Navigation/routes.tsx@@ -19,6 +19,9 @@ import {File, TerminalSquare,} from 'lucide-react'+import logoOpenAI from '@/images/logos/openai.svg'+import Image from 'next/image'+export const routes = [{title: 'Overview',@@ -94,6 +97,22 @@ export const routes = [},],},+ {+ title: 'LLM Platforms',+ links: [+ {+ icon: (+ <Image+ src={logoOpenAI}+ alt="OpenAI logo"+ className="h-4 w-4"+ />+ ),+ title: 'OpenAI',+ href: '/llm-platforms/openai',+ },+ ],+ },{title: 'Sandbox',links: [diff --git a/apps/docs/src/images/logos/openai.svg b/apps/docs/src/images/logos/openai.svgnew file mode 100644index 000000000..a553b3c96--- /dev/null+++ b/apps/docs/src/images/logos/openai.svg@@ -0,0 +1,12 @@+<svg width="320" height="320" viewBox="0 0 320 320" fill="none" xmlns="http://www.w3.org/2000/svg">+ <g clip-path="url(#clip0_10145_290560)">+ <path+ d="M297.06 130.97C304.32 109.18 301.82 85.31 290.21 65.49C272.75 35.09 237.65 19.45 203.37 26.81C188.12 9.63002 166.21 -0.139981 143.24 1.93887e-05C108.2 -0.0799806 77.11 22.48 66.33 55.82C43.82 60.43 24.39 74.52 13.02 94.49C-4.57001 124.81 -0.560007 163.03 22.94 189.03C15.68 210.82 18.18 234.69 29.79 254.51C47.25 284.91 82.35 300.55 116.63 293.19C131.87 310.37 153.79 320.14 176.76 319.99C211.82 320.08 242.92 297.5 253.7 264.13C276.21 259.52 295.64 245.43 307.01 225.46C324.58 195.14 320.56 156.95 297.07 130.95L297.06 130.97ZM176.78 299.08C162.75 299.1 149.16 294.19 138.39 285.2C138.88 284.94 139.73 284.47 140.28 284.13L204 247.33C207.26 245.48 209.26 242.01 209.24 238.26V148.43L236.17 163.98C236.46 164.12 236.65 164.4 236.69 164.72V239.11C236.65 272.19 209.86 299.01 176.78 299.08ZM47.94 244.05C40.91 231.91 38.38 217.68 40.79 203.87C41.26 204.15 42.09 204.66 42.68 205L106.4 241.8C109.63 243.69 113.63 243.69 116.87 241.8L194.66 196.88V227.98C194.68 228.3 194.53 228.61 194.28 228.81L129.87 266C101.18 282.52 64.54 272.7 47.95 244.05H47.94ZM31.17 104.96C38.17 92.8 49.22 83.5 62.38 78.67C62.38 79.22 62.35 80.19 62.35 80.87V154.48C62.33 158.22 64.33 161.69 67.58 163.54L145.37 208.45L118.44 224C118.17 224.18 117.83 224.21 117.53 224.08L53.11 186.86C24.48 170.28 14.66 133.65 31.16 104.97L31.17 104.96ZM252.43 156.45L174.64 111.53L201.57 95.99C201.84 95.81 202.18 95.78 202.48 95.91L266.9 133.1C295.58 149.67 305.41 186.36 288.84 215.04C281.83 227.18 270.79 236.48 257.64 241.32V165.51C257.67 161.77 255.68 158.31 252.44 156.45H252.43ZM279.23 116.11C278.76 115.82 277.93 115.32 277.34 114.98L213.62 78.18C210.39 76.29 206.39 76.29 203.15 78.18L125.36 123.1V92C125.34 91.68 125.49 91.37 125.74 91.17L190.15 54.01C218.84 37.46 255.52 47.31 272.06 76.01C279.05 88.13 281.58 102.32 279.21 116.11H279.23ZM110.72 171.54L83.78 155.99C83.49 155.85 83.3 155.57 83.26 155.25V80.86C83.28 47.74 110.15 20.9 143.27 20.92C157.28 20.92 170.84 25.84 181.61 34.8C181.12 35.06 180.28 35.53 179.72 35.87L116 72.67C112.74 74.52 110.74 77.98 110.76 81.73L110.72 171.52V171.54ZM125.35 140L160 119.99L194.65 139.99V180L160 200L125.35 180V140Z"+ fill="white" />+ </g>+ <defs>+ <clipPath id="clip0_10145_290560">+ <rect width="320" height="320" fill="white" />+ </clipPath>+ </defs>+</svg>\ No newline at end of file