We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c86b153 commit 29d1a70Copy full SHA for 29d1a70
codeinterpreterapi/schema/file.py
@@ -9,6 +9,8 @@ class File(BaseModel):
9
10
@classmethod
11
def from_path(cls, path: str):
12
+ if not path.startswith("/"):
13
+ path = f"./{path}"
14
with open(path, "rb") as f:
15
path = path.split("/")[-1]
16
return cls(name=path, content=f.read())
@@ -33,6 +35,8 @@ async def afrom_url(cls, url: str):
33
35
return cls(name=url.split("/")[-1], content=await r.read())
34
36
37
def save(self, path: str):
38
39
40
with open(path, "wb") as f:
41
f.write(self.content)
42
0 commit comments