Skip to content

Commit

Permalink
feat: allow run customization though SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
adeprez committed Oct 4, 2024
1 parent 6a04de6 commit 77e59b5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lavague-sdk/lavague/sdk/agent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional
from lavague.sdk.trajectory import Trajectory
from lavague.sdk.client import LaVague
from lavague.sdk.client import LaVague, RunRequest
from lavague.sdk.utilities.config import get_config


Expand All @@ -15,15 +15,26 @@ def __init__(
self,
api_key: Optional[str] = None,
client: Optional[LaVague] = None,
create_public_runs: bool = False,
):
if client is None:
if api_key is None:
api_key = get_config("LAVAGUE_API_KEY")
client = LaVague(api_key=api_key)
self.client = client
self.create_public_runs = create_public_runs

def run(self, url: str, objective: str, async_run=False) -> Trajectory:
trajectory = self.client.run(url, objective, step_by_step=True)
def run(
self, url: str, objective: str, async_run=False, viewport_size=(1096, 1096)
) -> Trajectory:
request = RunRequest(
url=url,
objective=objective,
step_by_step=True,
is_public=self.create_public_runs,
viewport_size=viewport_size,
)
trajectory = self.client.run(request)
if not async_run:
trajectory.run_to_completion()
return trajectory
Expand Down

0 comments on commit 77e59b5

Please sign in to comment.