Spaces:
Runtime error
Runtime error
Shroominic
commited on
Commit
·
ecd2209
1
Parent(s):
000213d
📠 fix typing for python3.9
Browse files
codeinterpreterapi/chains/modifications_check.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import json
|
| 2 |
-
from typing import List
|
| 3 |
|
| 4 |
from langchain.base_language import BaseLanguageModel
|
| 5 |
from langchain.chat_models.openai import ChatOpenAI
|
|
@@ -12,7 +12,7 @@ async def get_file_modifications(
|
|
| 12 |
code: str,
|
| 13 |
llm: BaseLanguageModel,
|
| 14 |
retry: int = 2,
|
| 15 |
-
) -> List[str]
|
| 16 |
if retry < 1:
|
| 17 |
return None
|
| 18 |
messages = determine_modifications_prompt.format_prompt(code=code).to_messages()
|
|
|
|
| 1 |
import json
|
| 2 |
+
from typing import List, Optional
|
| 3 |
|
| 4 |
from langchain.base_language import BaseLanguageModel
|
| 5 |
from langchain.chat_models.openai import ChatOpenAI
|
|
|
|
| 12 |
code: str,
|
| 13 |
llm: BaseLanguageModel,
|
| 14 |
retry: int = 2,
|
| 15 |
+
) -> Optional[List[str]]:
|
| 16 |
if retry < 1:
|
| 17 |
return None
|
| 18 |
messages = determine_modifications_prompt.format_prompt(code=code).to_messages()
|
codeinterpreterapi/config.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from pydantic import BaseSettings
|
| 2 |
from dotenv import load_dotenv
|
|
|
|
| 3 |
|
| 4 |
# .env file
|
| 5 |
load_dotenv()
|
|
@@ -12,8 +13,8 @@ class CodeInterpreterAPISettings(BaseSettings):
|
|
| 12 |
|
| 13 |
VERBOSE: bool = False
|
| 14 |
|
| 15 |
-
CODEBOX_API_KEY: str
|
| 16 |
-
OPENAI_API_KEY: str
|
| 17 |
|
| 18 |
|
| 19 |
settings = CodeInterpreterAPISettings()
|
|
|
|
| 1 |
from pydantic import BaseSettings
|
| 2 |
from dotenv import load_dotenv
|
| 3 |
+
from typing import Optional
|
| 4 |
|
| 5 |
# .env file
|
| 6 |
load_dotenv()
|
|
|
|
| 13 |
|
| 14 |
VERBOSE: bool = False
|
| 15 |
|
| 16 |
+
CODEBOX_API_KEY: Optional[str] = None
|
| 17 |
+
OPENAI_API_KEY: Optional[str] = None
|
| 18 |
|
| 19 |
|
| 20 |
settings = CodeInterpreterAPISettings()
|
codeinterpreterapi/session.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import uuid, base64, re
|
| 2 |
from io import BytesIO
|
|
|
|
| 3 |
from codeboxapi import CodeBox # type: ignore
|
| 4 |
from codeboxapi.schema import CodeBoxOutput # type: ignore
|
| 5 |
from langchain.tools import StructuredTool
|
|
@@ -45,7 +46,7 @@ class CodeInterpreterSession:
|
|
| 45 |
),
|
| 46 |
]
|
| 47 |
|
| 48 |
-
def _llm(self, model: str
|
| 49 |
if model is None:
|
| 50 |
model = "gpt-4"
|
| 51 |
|
|
|
|
| 1 |
import uuid, base64, re
|
| 2 |
from io import BytesIO
|
| 3 |
+
from typing import Optional
|
| 4 |
from codeboxapi import CodeBox # type: ignore
|
| 5 |
from codeboxapi.schema import CodeBoxOutput # type: ignore
|
| 6 |
from langchain.tools import StructuredTool
|
|
|
|
| 46 |
),
|
| 47 |
]
|
| 48 |
|
| 49 |
+
def _llm(self, model: Optional[str] = None, openai_api_key: Optional[str] = None) -> BaseChatModel:
|
| 50 |
if model is None:
|
| 51 |
model = "gpt-4"
|
| 52 |
|