skyvern-llamaindex 0.2.0__py3-none-any.whl → 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- skyvern_llamaindex/agent.py +43 -5
- skyvern_llamaindex/client.py +38 -4
- {skyvern_llamaindex-0.2.0.dist-info → skyvern_llamaindex-0.2.1.dist-info}/METADATA +1 -1
- skyvern_llamaindex-0.2.1.dist-info/RECORD +8 -0
- skyvern_llamaindex-0.2.0.dist-info/RECORD +0 -8
- {skyvern_llamaindex-0.2.0.dist-info → skyvern_llamaindex-0.2.1.dist-info}/WHEEL +0 -0
skyvern_llamaindex/agent.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Any, List
|
2
2
|
|
3
3
|
from llama_index.core.tools import FunctionTool
|
4
4
|
from llama_index.core.tools.tool_spec.base import SPEC_FUNCTION_TYPE, BaseToolSpec
|
@@ -11,7 +11,7 @@ from skyvern.schemas.runs import RunEngine
|
|
11
11
|
|
12
12
|
|
13
13
|
class SkyvernTool:
|
14
|
-
def __init__(self, agent:
|
14
|
+
def __init__(self, agent: Skyvern | None = None):
|
15
15
|
if agent is None:
|
16
16
|
agent = Skyvern(base_url=None, api_key=None)
|
17
17
|
self.agent = agent
|
@@ -49,7 +49,13 @@ class SkyvernTaskToolSpec(BaseToolSpec):
|
|
49
49
|
self.engine = engine
|
50
50
|
self.run_task_timeout_seconds = run_task_timeout_seconds
|
51
51
|
|
52
|
-
async def run_task(
|
52
|
+
async def run_task(
|
53
|
+
self,
|
54
|
+
user_prompt: str | None = None,
|
55
|
+
url: str | None = None,
|
56
|
+
*_: Any,
|
57
|
+
**kw: Any,
|
58
|
+
) -> TaskRunResponse:
|
53
59
|
"""
|
54
60
|
Use Skyvern agent to run a task. This function won't return until the task is finished.
|
55
61
|
|
@@ -57,6 +63,17 @@ class SkyvernTaskToolSpec(BaseToolSpec):
|
|
57
63
|
user_prompt[str]: The user's prompt describing the task.
|
58
64
|
url (Optional[str]): The URL of the target website for the task.
|
59
65
|
"""
|
66
|
+
if user_prompt is None and kw.get("args"):
|
67
|
+
user_prompt = kw["args"][0]
|
68
|
+
|
69
|
+
if url is None:
|
70
|
+
if kw.get("args") and len(kw["args"]) > 1:
|
71
|
+
url = kw["args"][1]
|
72
|
+
elif kw.get("kwargs"):
|
73
|
+
url = kw["kwargs"].get("url")
|
74
|
+
|
75
|
+
assert user_prompt is not None, "user_prompt is required"
|
76
|
+
|
60
77
|
return await self.agent.run_task(
|
61
78
|
prompt=user_prompt,
|
62
79
|
url=url,
|
@@ -65,7 +82,13 @@ class SkyvernTaskToolSpec(BaseToolSpec):
|
|
65
82
|
wait_for_completion=True,
|
66
83
|
)
|
67
84
|
|
68
|
-
async def dispatch_task(
|
85
|
+
async def dispatch_task(
|
86
|
+
self,
|
87
|
+
user_prompt: str | None = None,
|
88
|
+
url: str | None = None,
|
89
|
+
*_: Any,
|
90
|
+
**kw: Any,
|
91
|
+
) -> TaskRunResponse:
|
69
92
|
"""
|
70
93
|
Use Skyvern agent to dispatch a task. This function will return immediately and the task will be running in the background.
|
71
94
|
|
@@ -73,6 +96,17 @@ class SkyvernTaskToolSpec(BaseToolSpec):
|
|
73
96
|
user_prompt[str]: The user's prompt describing the task.
|
74
97
|
url (Optional[str]): The URL of the target website for the task.
|
75
98
|
"""
|
99
|
+
if user_prompt is None and kw.get("args"):
|
100
|
+
user_prompt = kw["args"][0]
|
101
|
+
|
102
|
+
if url is None:
|
103
|
+
if kw.get("args") and len(kw["args"]) > 1:
|
104
|
+
url = kw["args"][1]
|
105
|
+
elif kw.get("kwargs"):
|
106
|
+
url = kw["kwargs"].get("url")
|
107
|
+
|
108
|
+
assert user_prompt is not None, "user_prompt is required"
|
109
|
+
|
76
110
|
return await self.agent.run_task(
|
77
111
|
prompt=user_prompt,
|
78
112
|
url=url,
|
@@ -81,11 +115,15 @@ class SkyvernTaskToolSpec(BaseToolSpec):
|
|
81
115
|
wait_for_completion=False,
|
82
116
|
)
|
83
117
|
|
84
|
-
async def get_task(self, task_id: str) -> GetRunResponse | None:
|
118
|
+
async def get_task(self, task_id: str | None = None, *_: Any, **kwargs: Any) -> GetRunResponse | None:
|
85
119
|
"""
|
86
120
|
Use Skyvern agent to get a task.
|
87
121
|
|
88
122
|
Args:
|
89
123
|
task_id[str]: The id of the task.
|
90
124
|
"""
|
125
|
+
if task_id is None and "args" in kwargs:
|
126
|
+
task_id = kwargs["args"][0]
|
127
|
+
|
128
|
+
assert task_id is not None, "task_id is required"
|
91
129
|
return await self.agent.get_run(run_id=task_id)
|
skyvern_llamaindex/client.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Any, List
|
2
2
|
|
3
3
|
from llama_index.core.tools import FunctionTool
|
4
4
|
from llama_index.core.tools.tool_spec.base import SPEC_FUNCTION_TYPE, BaseToolSpec
|
@@ -59,7 +59,13 @@ class SkyvernTaskToolSpec(BaseToolSpec):
|
|
59
59
|
self.run_task_timeout_seconds = run_task_timeout_seconds
|
60
60
|
self.client = Skyvern(base_url=base_url, api_key=api_key)
|
61
61
|
|
62
|
-
async def run_task(
|
62
|
+
async def run_task(
|
63
|
+
self,
|
64
|
+
user_prompt: str | None = None,
|
65
|
+
url: str | None = None,
|
66
|
+
*_: Any,
|
67
|
+
**kw: Any,
|
68
|
+
) -> TaskRunResponse:
|
63
69
|
"""
|
64
70
|
Use Skyvern client to run a task. This function won't return until the task is finished.
|
65
71
|
|
@@ -67,6 +73,16 @@ class SkyvernTaskToolSpec(BaseToolSpec):
|
|
67
73
|
user_prompt[str]: The user's prompt describing the task.
|
68
74
|
url (Optional[str]): The URL of the target website for the task.
|
69
75
|
"""
|
76
|
+
if user_prompt is None and kw.get("args"):
|
77
|
+
user_prompt = kw["args"][0]
|
78
|
+
|
79
|
+
if url is None:
|
80
|
+
if kw.get("args") and len(kw["args"]) > 1:
|
81
|
+
url = kw["args"][1]
|
82
|
+
elif kw.get("kwargs"):
|
83
|
+
url = kw["kwargs"].get("url")
|
84
|
+
|
85
|
+
assert user_prompt is not None, "user_prompt is required"
|
70
86
|
|
71
87
|
return await self.client.run_task(
|
72
88
|
prompt=user_prompt,
|
@@ -76,7 +92,13 @@ class SkyvernTaskToolSpec(BaseToolSpec):
|
|
76
92
|
wait_for_completion=True,
|
77
93
|
)
|
78
94
|
|
79
|
-
async def dispatch_task(
|
95
|
+
async def dispatch_task(
|
96
|
+
self,
|
97
|
+
user_prompt: str | None = None,
|
98
|
+
url: str | None = None,
|
99
|
+
*_: Any,
|
100
|
+
**kw: Any,
|
101
|
+
) -> TaskRunResponse:
|
80
102
|
"""
|
81
103
|
Use Skyvern client to dispatch a task. This function will return immediately and the task will be running in the background.
|
82
104
|
|
@@ -84,7 +106,16 @@ class SkyvernTaskToolSpec(BaseToolSpec):
|
|
84
106
|
user_prompt[str]: The user's prompt describing the task.
|
85
107
|
url (Optional[str]): The URL of the target website for the task.
|
86
108
|
"""
|
109
|
+
if user_prompt is None and kw.get("args"):
|
110
|
+
user_prompt = kw["args"][0]
|
111
|
+
|
112
|
+
if url is None:
|
113
|
+
if kw.get("args") and len(kw["args"]) > 1:
|
114
|
+
url = kw["args"][1]
|
115
|
+
elif kw.get("kwargs"):
|
116
|
+
url = kw["kwargs"].get("url")
|
87
117
|
|
118
|
+
assert user_prompt is not None, "user_prompt is required"
|
88
119
|
return await self.client.run_task(
|
89
120
|
prompt=user_prompt,
|
90
121
|
url=url,
|
@@ -93,12 +124,15 @@ class SkyvernTaskToolSpec(BaseToolSpec):
|
|
93
124
|
wait_for_completion=False,
|
94
125
|
)
|
95
126
|
|
96
|
-
async def get_task(self, task_id: str) -> GetRunResponse | None:
|
127
|
+
async def get_task(self, task_id: str | None = None, *_: Any, **kwargs: Any) -> GetRunResponse | None:
|
97
128
|
"""
|
98
129
|
Use Skyvern client to get a task.
|
99
130
|
|
100
131
|
Args:
|
101
132
|
task_id[str]: The id of the task.
|
102
133
|
"""
|
134
|
+
if task_id is None and "args" in kwargs:
|
135
|
+
task_id = kwargs["args"][0]
|
103
136
|
|
137
|
+
assert task_id is not None, "task_id is required"
|
104
138
|
return await self.client.get_run(run_id=task_id)
|
@@ -0,0 +1,8 @@
|
|
1
|
+
skyvern_llamaindex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
skyvern_llamaindex/agent.py,sha256=FIPia1j-S3cqbGb763CXgwjYxkvOBty17dEW3qst9vA,4237
|
3
|
+
skyvern_llamaindex/client.py,sha256=SiJPmXvkjunPGxfmbIPu00f1ywwVKFicMwztESLFnT8,4380
|
4
|
+
skyvern_llamaindex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
skyvern_llamaindex/settings.py,sha256=PG8SyXuwXvRmgWLEkF8i7bgn8pcvznin7opzTMFKEkM,396
|
6
|
+
skyvern_llamaindex-0.2.1.dist-info/METADATA,sha256=ESAIzftsBuSSxwG1jc_fJIqFaUFp3NjY8S8gGvZ30DU,10640
|
7
|
+
skyvern_llamaindex-0.2.1.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
8
|
+
skyvern_llamaindex-0.2.1.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
skyvern_llamaindex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
skyvern_llamaindex/agent.py,sha256=wEpTUJpP0_VL0l0v9VckrG0pX96AI4T6M74Z6mUgdvI,3191
|
3
|
-
skyvern_llamaindex/client.py,sha256=KRFlJgzsYJUAutvqMSNH0QfzEkRHJT_lkr_fSrfFsxk,3335
|
4
|
-
skyvern_llamaindex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
skyvern_llamaindex/settings.py,sha256=PG8SyXuwXvRmgWLEkF8i7bgn8pcvznin7opzTMFKEkM,396
|
6
|
-
skyvern_llamaindex-0.2.0.dist-info/METADATA,sha256=RZUCTR-zR9JEwVPSa4KfX3ct0n53Klulh1gpZIZy2UA,10640
|
7
|
-
skyvern_llamaindex-0.2.0.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
8
|
-
skyvern_llamaindex-0.2.0.dist-info/RECORD,,
|
File without changes
|