mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-03 22:33:19 +00:00
refactor:langsmith.py changes
This commit is contained in:
parent
838e042fe4
commit
e7085154da
1 changed files with 8 additions and 4 deletions
|
|
@ -20,8 +20,7 @@ from deepagents.backends.protocol import (
|
||||||
)
|
)
|
||||||
from deepagents.backends.sandbox import BaseSandbox
|
from deepagents.backends.sandbox import BaseSandbox
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
from langsmith.sandbox import Sandbox, SandboxClient, SandboxTemplate
|
||||||
from langsmith.sandbox import Sandbox, SandboxClient, SandboxTemplate
|
|
||||||
|
|
||||||
|
|
||||||
class SandboxProvider(ABC):
|
class SandboxProvider(ABC):
|
||||||
|
|
@ -101,7 +100,9 @@ class LangSmithBackend(BaseSandbox):
|
||||||
responses: list[FileDownloadResponse] = []
|
responses: list[FileDownloadResponse] = []
|
||||||
for path in paths:
|
for path in paths:
|
||||||
content = self._sandbox.read(path)
|
content = self._sandbox.read(path)
|
||||||
responses.append(FileDownloadResponse(path=path, content=content, error=None))
|
responses.append(
|
||||||
|
FileDownloadResponse(path=path, content=content, error=None)
|
||||||
|
)
|
||||||
return responses
|
return responses
|
||||||
|
|
||||||
def upload_files(self, files: list[tuple[str, bytes]]) -> list[FileUploadResponse]:
|
def upload_files(self, files: list[tuple[str, bytes]]) -> list[FileUploadResponse]:
|
||||||
|
|
@ -160,7 +161,10 @@ class LangSmithProvider(SandboxProvider):
|
||||||
template_name=resolved_template_name, timeout=timeout
|
template_name=resolved_template_name, timeout=timeout
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = f"Failed to create sandbox from template '{resolved_template_name}': {e}"
|
msg = (
|
||||||
|
f"Failed to create sandbox from template "
|
||||||
|
f"'{resolved_template_name}': {e}"
|
||||||
|
)
|
||||||
raise RuntimeError(msg) from e
|
raise RuntimeError(msg) from e
|
||||||
|
|
||||||
# Verify sandbox is ready by polling
|
# Verify sandbox is ready by polling
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue