Skip to content

Commit

Permalink
fix: remove typescript and bash
Browse files Browse the repository at this point in the history
  • Loading branch information
imotai committed Sep 11, 2023
1 parent ffa12d5 commit 8836116
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 46 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ jobs:
pytest tests/*
cd ${WS_DIR}/agent
pytest tests/*
cd ${WS_DIR}
bash clean_sandbox.sh
- uses: actions/upload-artifact@v3
if: failure()
with:
Expand Down
28 changes: 15 additions & 13 deletions agent/src/octopus_agent/agent_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,34 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""
"""
""" """
import click
import asyncio
from octopus_agent.agent_sdk import AgentSDK


async def add_kernel(endpoint, api_key, kernel_endpoint, kernel_api_key, workspace):
sdk = AgentSDK(endpoint, api_key)
sdk.connect()
try:
await sdk.add_kernel(kernel_api_key, kernel_endpoint, workspace)
print("add kernel %s done"%kernel_endpoint)
print("add kernel %s done" % kernel_endpoint)
except Exception as ex:
print("add kernel %s failed"%kernel_endpoint)
print("add kernel %s failed" % kernel_endpoint)


@click.command()
@click.option('--kernel_endpoint', help='the endpoint of kernel')
@click.option('--kernel_api_key', help="the api key of kernel")
@click.option('--kernel_workspace', help="the workspace of kernel")
@click.option('--agent_endpoint', help="the endpoint of agent")
@click.option('--admin_key', help="the admin key of agent")
@click.option("--kernel_endpoint", help="the endpoint of kernel")
@click.option("--kernel_api_key", help="the api key of kernel")
@click.option("--kernel_workspace", help="the workspace of kernel")
@click.option("--agent_endpoint", help="the endpoint of agent")
@click.option("--admin_key", help="the admin key of agent")
def setup(kernel_endpoint, kernel_api_key, kernel_workspace, agent_endpoint, admin_key):
if not kernel_endpoint or not kernel_api_key or not admin_key or not agent_endpoint:
print("kernel_endpoint or kernel_api_key or admin key is empty")
return
asyncio.run(add_kernel(agent_endpoint, admin_key, kernel_endpoint, kernel_api_key,
kernel_workspace))

asyncio.run(
add_kernel(
agent_endpoint, admin_key, kernel_endpoint, kernel_api_key, kernel_workspace
)
)
2 changes: 0 additions & 2 deletions agent/src/octopus_agent/langchain_agent_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ def build_openai_agent(llm, sdk, workspace, max_iterations, verbose):
# init the agent
tools = [
ExecutePythonCodeTool(octopus_api=api),
ExecuteShellCodeTool(octopus_api=api),
ExecuteTypescriptCodeTool(octopus_api=api),
PrintCodeTool(),
PrintFinalAnswerTool(),
]
Expand Down
2 changes: 1 addition & 1 deletion agent/src/octopus_agent/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Thirdly, the programming environment used to execute code has the following capabilities
* Internet connection: This allows the programming environment to access online resources, such as documentation, libraries, and code repositories.
* IPython kernel: This allows the programming environment to execute Python, TypeScript, and shell scripts.
* IPython kernel: This allows the programming environment to execute Python code
* Filesystem: This allows the programming environment to open, write, and delete files in the workspace directory.
* Lots of installed Python libraries:These includes the following popular libraries:
* pandas:data analysis and manipulation tool
Expand Down
10 changes: 5 additions & 5 deletions agent/tests/agent_sdk_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ async def test_upload_smoke_test(agent_sdk):
path = os.path.abspath(__file__)
await sdk.upload_file(path, "agent_sdk_tests.py")
try:
responds = []
async for respond in sdk.prompt("write a hello world in python"):
responds.append(respond)
assert len(responds) > 0, "no responds for the prompt"
responds = []
async for respond in sdk.prompt("write a hello world in python"):
responds.append(respond)
assert len(responds) > 0, "no responds for the prompt"
except Exception as ex:
assert 0, str(ex)
assert 0, str(ex)
22 changes: 0 additions & 22 deletions kernel/tests/kernel_client_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,28 +113,6 @@ async def test_stderr_occurs(kernel_manager):
kernel_client.stop_client()


@pytest.mark.asyncio
async def test_ts_stdout_occurs(ts_kernel_manager):
"""Test stdout occurs"""
kernel_client = KernelClient(ts_kernel_manager.config_path)
await kernel_client.start_client()
logger.info("is alive %s", await kernel_client.is_alive())
code = """console.log("hello world!")"""
kernel_client.execute(code)
messages = []
async for msg in kernel_client.read_response():
if not msg:
break
logger.info(msg)
messages.append(msg)
filtered = list(filter(lambda x: x["msg_type"] == "stream", messages))
assert len(filtered) > 0, messages
assert filtered[0]["content"]["name"] == "stdout"
await asyncio.sleep(2)
await kernel_client.stop_watch()
kernel_client.stop_client()


@pytest.mark.asyncio
async def test_stdout_occurs(kernel_manager):
"""Test stdout occurs"""
Expand Down
2 changes: 1 addition & 1 deletion start_sandbox.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /bin/sh
#
# start_local.sh
ps -eu | grep python3 | grep -v grep | awk '{print $2}' | while read line; do kill -9 $line; done
ps -ef | grep python3 | grep -v grep | awk '{print $2}' | while read line; do kill -9 $line; done
WORKDIR=`pwd`

cd ${WORKDIR}/proto && make && pip install .
Expand Down

0 comments on commit 8836116

Please sign in to comment.