-
-
Notifications
You must be signed in to change notification settings - Fork 407
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
4bb4006
commit ae756d9
Showing
31 changed files
with
2,624 additions
and
234 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.3.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/psf/black | ||
rev: 23.7.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.4.1 | ||
hooks: | ||
- id: mypy | ||
args: [--ignore-missing-imports, --follow-imports=skip] | ||
additional_dependencies: [types-requests] | ||
- repo: https://github.com/pre-commit/mirrors-isort | ||
rev: v5.9.3 | ||
hooks: | ||
- id: isort | ||
args: [--profile=black] | ||
- repo: https://github.com/PYCQA/flake8 | ||
rev: 6.1.0 | ||
hooks: | ||
- id: flake8 | ||
args: [--max-line-length=88] |
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,2 +1,2 @@ | ||
from codeinterpreterapi.session import CodeInterpreterSession | ||
from codeinterpreterapi.schema import File | ||
from codeinterpreterapi.session import CodeInterpreterSession |
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,2 +1,2 @@ | ||
# TODO: override some methods of the ConversationalAgent class | ||
# TODO: override some methods of the ConversationalAgent class | ||
# to improve the agent's performance |
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,3 +1,3 @@ | ||
from .extract_code import extract_python_code | ||
from .modifications_check import get_file_modifications | ||
from .rm_dl_link import remove_download_link | ||
from .extract_code import extract_python_code |
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
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,3 +1,3 @@ | ||
from .system_message import system_message as code_interpreter_system_message | ||
from .modifications_check import determine_modifications_prompt | ||
from .remove_dl_link import remove_dl_link_prompt | ||
from .remove_dl_link import remove_dl_link_prompt | ||
from .system_message import system_message as code_interpreter_system_message |
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,56 +1,54 @@ | ||
from langchain.prompts import PromptTemplate | ||
|
||
|
||
determine_modifications_prompt = PromptTemplate( | ||
input_variables=["code"], | ||
template= | ||
"The user will input some code and you need to determine if the code makes any changes to the file system. \n" | ||
"With changes it means creating new files or modifying exsisting ones.\n" | ||
"Format your answer as JSON inside a codeblock with a list of filenames that are modified by the code.\n" | ||
"If the code does not make any changes to the file system, return an empty list.\n\n" | ||
"Determine modifications:\n" | ||
"```python\n" | ||
"import matplotlib.pyplot as plt\n" | ||
"import numpy as np\n\n" | ||
"t = np.arange(0.0, 4.0*np.pi, 0.1)\n\n" | ||
"s = np.sin(t)\n\n" | ||
"fig, ax = plt.subplots()\n\n" | ||
"ax.plot(t, s)\n\n" | ||
"ax.set(xlabel=\"time (s)\", ylabel=\"sin(t)\",\n" | ||
" title=\"Simple Sin Wave\")\n" | ||
"ax.grid()\n\n" | ||
"plt.savefig(\"sin_wave.png\")\n" | ||
"```\n\n" | ||
"Answer:\n" | ||
"```json\n" | ||
"{{\n" | ||
" \"modifications\": [\"sin_wave.png\"]\n" | ||
"}}\n" | ||
"```\n\n" | ||
"Determine modifications:\n" | ||
"```python\n" | ||
"import matplotlib.pyplot as plt\n" | ||
"import numpy as np\n\n" | ||
"x = np.linspace(0, 10, 100)\n" | ||
"y = x**2\n\n" | ||
"plt.figure(figsize=(8, 6))\n" | ||
"plt.plot(x, y)\n" | ||
"plt.title(\"Simple Quadratic Function\")\n" | ||
"plt.xlabel(\"x\")\n" | ||
"plt.ylabel(\"y = x^2\")\n" | ||
"plt.grid(True)\n" | ||
"plt.show()\n" | ||
"```\n\n" | ||
"Answer:\n" | ||
"```json\n" | ||
"{{\n" | ||
" \"modifications\": []\n" | ||
"}}\n" | ||
"```\n\n" | ||
"Determine modifications:\n" | ||
"```python\n" | ||
"{code}\n" | ||
"```\n\n" | ||
"Answer:\n" | ||
"```json\n", | ||
template="The user will input some code and you need to determine if the code makes any changes to the file system. \n" | ||
"With changes it means creating new files or modifying exsisting ones.\n" | ||
"Format your answer as JSON inside a codeblock with a list of filenames that are modified by the code.\n" | ||
"If the code does not make any changes to the file system, return an empty list.\n\n" | ||
"Determine modifications:\n" | ||
"```python\n" | ||
"import matplotlib.pyplot as plt\n" | ||
"import numpy as np\n\n" | ||
"t = np.arange(0.0, 4.0*np.pi, 0.1)\n\n" | ||
"s = np.sin(t)\n\n" | ||
"fig, ax = plt.subplots()\n\n" | ||
"ax.plot(t, s)\n\n" | ||
'ax.set(xlabel="time (s)", ylabel="sin(t)",\n' | ||
' title="Simple Sin Wave")\n' | ||
"ax.grid()\n\n" | ||
'plt.savefig("sin_wave.png")\n' | ||
"```\n\n" | ||
"Answer:\n" | ||
"```json\n" | ||
"{{\n" | ||
' "modifications": ["sin_wave.png"]\n' | ||
"}}\n" | ||
"```\n\n" | ||
"Determine modifications:\n" | ||
"```python\n" | ||
"import matplotlib.pyplot as plt\n" | ||
"import numpy as np\n\n" | ||
"x = np.linspace(0, 10, 100)\n" | ||
"y = x**2\n\n" | ||
"plt.figure(figsize=(8, 6))\n" | ||
"plt.plot(x, y)\n" | ||
'plt.title("Simple Quadratic Function")\n' | ||
'plt.xlabel("x")\n' | ||
'plt.ylabel("y = x^2")\n' | ||
"plt.grid(True)\n" | ||
"plt.show()\n" | ||
"```\n\n" | ||
"Answer:\n" | ||
"```json\n" | ||
"{{\n" | ||
' "modifications": []\n' | ||
"}}\n" | ||
"```\n\n" | ||
"Determine modifications:\n" | ||
"```python\n" | ||
"{code}\n" | ||
"```\n\n" | ||
"Answer:\n" | ||
"```json\n", | ||
) |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .file import File | ||
from .response import CodeInterpreterResponse, UserRequest | ||
from .input import CodeInput, FileInput | ||
from .response import CodeInterpreterResponse, UserRequest |
Oops, something went wrong.