-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b0b01d
commit c18bc90
Showing
24 changed files
with
400 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# You can use most Debian-based base images | ||
FROM e2bdev/code-interpreter:latest | ||
|
||
# Install dependencies and customize sandbox | ||
RUN pip install git+https://github.com/huggingface/agents.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This is a config for E2B sandbox template. | ||
# You can use template ID (qywp2ctmu2q7jzprcf4j) to create a sandbox: | ||
|
||
# Python SDK | ||
# from e2b import Sandbox, AsyncSandbox | ||
# sandbox = Sandbox("qywp2ctmu2q7jzprcf4j") # Sync sandbox | ||
# sandbox = await AsyncSandbox.create("qywp2ctmu2q7jzprcf4j") # Async sandbox | ||
|
||
# JS SDK | ||
# import { Sandbox } from 'e2b' | ||
# const sandbox = await Sandbox.create('qywp2ctmu2q7jzprcf4j') | ||
|
||
team_id = "f8776d3a-df2f-4a1d-af48-68c2e13b3b87" | ||
start_cmd = "/root/.jupyter/start-up.sh" | ||
dockerfile = "e2b.Dockerfile" | ||
template_id = "qywp2ctmu2q7jzprcf4j" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
from agents.tool import Tool | ||
from agents.tools import Tool | ||
|
||
|
||
class DummyTool(Tool): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from agents import Tool, CodeAgent | ||
from agents.default_tools.search import VisitWebpageTool | ||
from dotenv import load_dotenv | ||
load_dotenv() | ||
|
||
LAUNCH_GRADIO = False | ||
|
||
class GetCatImageTool(Tool): | ||
name="get_cat_image" | ||
description = "Get a cat image" | ||
inputs = {} | ||
output_type = "image" | ||
|
||
def __init__(self): | ||
super().__init__() | ||
self.url = "https://em-content.zobj.net/source/twitter/53/robot-face_1f916.png" | ||
|
||
def forward(self): | ||
from PIL import Image | ||
import requests | ||
from io import BytesIO | ||
|
||
response = requests.get(self.url) | ||
|
||
return Image.open(BytesIO(response.content)) | ||
|
||
get_cat_image = GetCatImageTool() | ||
|
||
|
||
agent = CodeAgent( | ||
tools = [get_cat_image, VisitWebpageTool()], | ||
additional_authorized_imports=["Pillow", "requests", "markdownify"], # "duckduckgo-search", | ||
use_e2b_executor=False | ||
) | ||
|
||
if LAUNCH_GRADIO: | ||
from agents.gradio_ui import GradioUI | ||
|
||
GradioUI(agent).launch() | ||
else: | ||
agent.run( | ||
"Return me an image of Lincoln's preferred pet", | ||
additional_context="Here is a webpage about US presidents and pets: https://www.9lives.com/blog/a-history-of-cats-in-the-white-house/" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.