Skip to content

Commit dccfe61

Browse files
author
Kye
committed
clean up of v
Former-commit-id: a6b8773
1 parent e039eeb commit dccfe61

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

DOCS/DOCUMENTATION.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,10 @@ The `temperature`, `top_p`, `top_k`, and `n` parameters control the randomness a
343343

344344

345345

346-
## `CodeInterpreterTool`:
346+
## `CodeInterpreter`:
347347

348348
```python
349-
tool = CodeInterpreterTool("Code Interpreter", "A tool to interpret code and generate useful outputs.")
349+
tool = CodeInterpreter("Code Interpreter", "A tool to interpret code and generate useful outputs.")
350350
tool.run("Plot the bitcoin chart of 2023 YTD")
351351

352352
# Or with file inputs
@@ -358,11 +358,11 @@ To use the asynchronous version, simply replace `run` with `arun` and ensure you
358358
```python
359359
import asyncio
360360

361-
tool = CodeInterpreterTool("Code Interpreter", "A tool to interpret code and generate useful outputs.")
361+
tool = CodeInterpreter("Code Interpreter", "A tool to interpret code and generate useful outputs.")
362362
asyncio.run(tool.arun("Plot the bitcoin chart of 2023 YTD"))
363363

364364
# Or with file inputs
365365
asyncio.run(tool.arun("Analyze this dataset and plot something interesting about it.", ["examples/assets/iris.csv"]))
366366
```
367367

368-
The `CodeInterpreterTool` class is a flexible tool that uses the `CodeInterpreterSession` from the `codeinterpreterapi` package to run the code interpretation and return the result. It provides both synchronous and asynchronous methods for convenience, and ensures that exceptions are handled gracefully.
368+
The `CodeInterpreter` class is a flexible tool that uses the `CodeInterpreterSession` from the `codeinterpreterapi` package to run the code interpretation and return the result. It provides both synchronous and asynchronous methods for convenience, and ensures that exceptions are handled gracefully.

swarms/agents/tools/code_intepretor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import Callable, Any, List
44
from codeinterpreterapi import CodeInterpreterSession, File, ToolException
55

6-
class CodeInterpreterTool(Tool):
6+
class CodeInterpreter(Tool):
77
def __init__(self, name: str, description: str):
88
super().__init__(name, description, self.run)
99

@@ -24,7 +24,7 @@ def run(self, user_request: str, file_paths: List[str] = []) -> Any:
2424
for file in response.files:
2525
file.show_image()
2626
except Exception as e:
27-
raise ToolException(f"Error running CodeInterpreterTool: {e}")
27+
raise ToolException(f"Error running CodeInterpreter: {e}")
2828
finally:
2929
# terminate the session
3030
session.stop()
@@ -46,14 +46,14 @@ async def arun(self, user_request: str, file_paths: List[str] = []) -> Any:
4646
for file in response.files:
4747
file.show_image()
4848
except Exception as e:
49-
raise ToolException(f"Error running CodeInterpreterTool: {e}")
49+
raise ToolException(f"Error running CodeInterpreter: {e}")
5050
finally:
5151
# terminate the session
5252
await session.astop()
5353

5454
"""
5555
56-
tool = CodeInterpreterTool("Code Interpreter", "A tool to interpret code and generate useful outputs.")
56+
tool = CodeInterpreter("Code Interpreter", "A tool to interpret code and generate useful outputs.")
5757
tool.run("Plot the bitcoin chart of 2023 YTD")
5858
5959
# Or with file inputs
@@ -63,7 +63,7 @@ async def arun(self, user_request: str, file_paths: List[str] = []) -> Any:
6363
6464
import asyncio
6565
66-
tool = CodeInterpreterTool("Code Interpreter", "A tool to interpret code and generate useful outputs.")
66+
tool = CodeInterpreter("Code Interpreter", "A tool to interpret code and generate useful outputs.")
6767
asyncio.run(tool.arun("Plot the bitcoin chart of 2023 YTD"))
6868
6969
# Or with file inputs

0 commit comments

Comments
 (0)