-
-
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
Showing
36 changed files
with
1,133 additions
and
682 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
OPENAI_API_KEY= # your openai api key (required) | ||
CODEBOX_API_KEY= # your codebox api key (optional, required for production) | ||
VERBOSE=False # set to True to enable verbose logging | ||
# (required) | ||
OPENAI_API_KEY= | ||
# (optional, required for production) | ||
# CODEBOX_API_KEY= | ||
# (set True to enable logging) | ||
VERBOSE=False | ||
|
||
STORAGE_TYPE="redis" # "file" or "redis" | ||
|
||
STORAGE_TYPE="file" # "file" or "redis" | ||
|
||
RD_HOST= | ||
RD_PORT= | ||
|
||
SESSION_STORAGE_FOLDER="session_storage" | ||
SESSION_STORAGE_FOLDER="session_storage" |
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,16 @@ | ||
name: code-check | ||
|
||
on: [push] | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
- name: Install pre-commit | ||
run: pip install pre-commit | ||
- name: Run pre-commit | ||
run: pre-commit run --all-files |
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,31 @@ | ||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
- name: Build package | ||
run: python -m build | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
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,4 @@ | ||
from codeinterpreterapi.schema import File | ||
from codeinterpreterapi.session import CodeInterpreterSession | ||
from codeinterpreterapi.schema import File | ||
|
||
__all__ = ["CodeInterpreterSession", "File"] |
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,3 @@ | ||
from .functions_agent import OpenAIFunctionsAgent | ||
|
||
__all__ = ["OpenAIFunctionsAgent"] |
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,2 @@ | ||
# 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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from .extract_code import extract_python_code | ||
from .modifications_check import get_file_modifications | ||
from .rm_dl_link import remove_download_link | ||
|
||
__all__ = [ | ||
"extract_python_code", | ||
"get_file_modifications", | ||
"remove_download_link", | ||
] |
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,41 @@ | ||
from langchain.base_language import BaseLanguageModel | ||
from langchain.chat_models.anthropic import ChatAnthropic | ||
|
||
|
||
# TODO: make async | ||
def extract_python_code( | ||
text: str, | ||
llm: BaseLanguageModel, | ||
retry: int = 2, | ||
): | ||
pass | ||
|
||
|
||
async def test(): | ||
llm = ChatAnthropic(model="claude-1.3") # type: ignore | ||
|
||
code = """ | ||
import matplotlib.pyplot as plt | ||
x = list(range(1, 11)) | ||
y = [29, 39, 23, 32, 4, 43, 43, 23, 43, 77] | ||
plt.plot(x, y, marker='o') | ||
plt.xlabel('Index') | ||
plt.ylabel('Value') | ||
plt.title('Data Plot') | ||
plt.show() | ||
""" | ||
|
||
print(extract_python_code(code, llm)) | ||
|
||
|
||
if __name__ == "__main__": | ||
import asyncio | ||
|
||
import dotenv | ||
|
||
dotenv.load_dotenv() | ||
|
||
asyncio.run(test()) |
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,9 @@ | ||
from .modifications_check import determine_modifications_prompt | ||
from .remove_dl_link import remove_dl_link_prompt | ||
from .system_message import system_message as code_interpreter_system_message | ||
from .modifications_check import determine_modifications_function, determine_modifications_prompt | ||
from .remove_dl_link import remove_dl_link_prompt | ||
|
||
__all__ = [ | ||
"determine_modifications_prompt", | ||
"remove_dl_link_prompt", | ||
"code_interpreter_system_message", | ||
] |
Oops, something went wrong.