Skip to content

Commit

Permalink
🗜️ squash schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
shroominic committed Dec 12, 2023
1 parent f88be8c commit ac9f2ea
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 69 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import asyncio

from typing import Any
from langchain.schema import AIMessage, HumanMessage
from langchain.pydantic_v1 import BaseModel
from codeboxapi.schema import CodeBoxStatus


class File(BaseModel):
Expand Down Expand Up @@ -87,3 +89,54 @@ def __str__(self) -> str:

def __repr__(self) -> str:
return f"File(name={self.name})"


class CodeInput(BaseModel):
code: str


class FileInput(BaseModel):
filename: str


class UserRequest(HumanMessage):
files: list[File] = []

def __str__(self) -> str:
return str(self.content)

def __repr__(self) -> str:
return f"UserRequest(content={self.content}, files={self.files})"


class CodeInterpreterResponse(AIMessage):
"""
Response from the code interpreter agent.
files: list of files to be sent to the user (File )
code_log: list[tuple[str, str]] = []
"""

files: list[File] = []
code_log: list[tuple[str, str]] = []

def show(self) -> None:
print("AI: ", self.content)
for file in self.files:
print("File: ", file.name)
file.show_image()

def __str__(self) -> str:
return str(self.content)

def __repr__(self) -> str:
return f"CodeInterpreterResponse(content={self.content}, files={self.files})"


class SessionStatus(CodeBoxStatus):
@classmethod
def from_codebox_status(cls, cbs: CodeBoxStatus) -> "SessionStatus":
return cls(status=cbs.status)

def __repr__(self) -> str:
return f"<SessionStatus status={self.status}>"
13 changes: 0 additions & 13 deletions src/codeinterpreterapi/schema/__init__.py

This file was deleted.

9 changes: 0 additions & 9 deletions src/codeinterpreterapi/schema/input.py

This file was deleted.

37 changes: 0 additions & 37 deletions src/codeinterpreterapi/schema/response.py

This file was deleted.

10 changes: 0 additions & 10 deletions src/codeinterpreterapi/schema/status.py

This file was deleted.

0 comments on commit ac9f2ea

Please sign in to comment.