skyvern-llamaindex 0.0.5__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.
@@ -1,17 +1,17 @@
1
- from typing import List, Optional
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
5
5
  from skyvern_llamaindex.settings import settings
6
6
 
7
7
  from skyvern import Skyvern
8
- from skyvern.client.agent.types.agent_get_run_response import AgentGetRunResponse
8
+ from skyvern.client.types.get_run_response import GetRunResponse
9
9
  from skyvern.client.types.task_run_response import TaskRunResponse
10
10
  from skyvern.schemas.runs import RunEngine
11
11
 
12
12
 
13
13
  class SkyvernTool:
14
- def __init__(self, agent: Optional[Skyvern] = None):
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(self, user_prompt: str, url: Optional[str] = None) -> TaskRunResponse:
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(self, user_prompt: str, url: Optional[str] = None) -> TaskRunResponse:
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) -> AgentGetRunResponse | 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)
@@ -1,4 +1,4 @@
1
- from typing import List, Optional
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
@@ -6,7 +6,7 @@ from pydantic import BaseModel
6
6
  from skyvern_llamaindex.settings import settings
7
7
 
8
8
  from skyvern import Skyvern
9
- from skyvern.client.agent.types.agent_get_run_response import AgentGetRunResponse
9
+ from skyvern.client.types.get_run_response import GetRunResponse
10
10
  from skyvern.client.types.task_run_response import TaskRunResponse
11
11
  from skyvern.schemas.runs import RunEngine
12
12
 
@@ -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(self, user_prompt: str, url: Optional[str] = None) -> TaskRunResponse:
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(self, user_prompt: str, url: Optional[str] = None) -> TaskRunResponse:
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) -> AgentGetRunResponse | 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)
@@ -1,14 +1,16 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: skyvern-llamaindex
3
- Version: 0.0.5
3
+ Version: 0.2.1
4
4
  Summary: Skyvern integration for LlamaIndex
5
5
  Author: lawyzheng
6
6
  Author-email: lawy@skyvern.com
7
- Requires-Python: >=3.11,<3.12
7
+ Requires-Python: >=3.11,<3.14
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
10
12
  Requires-Dist: llama-index (>=0.12.19,<0.13.0)
11
- Requires-Dist: skyvern (>=0.1.84)
13
+ Requires-Dist: skyvern (>=0.2.0)
12
14
  Description-Content-Type: text/markdown
13
15
 
14
16
  <!-- START doctoc generated TOC please keep comment here to allow auto update -->
@@ -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=0Qz1HOCcajL-uAzh6TT5pwS2AI8_IldBhzEIz3lm7SE,3213
3
- skyvern_llamaindex/client.py,sha256=0OCEUEmOP4UD6pR7Vt34lICFjU2NAS5ZI7ce0oIT4cA,3357
4
- skyvern_llamaindex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- skyvern_llamaindex/settings.py,sha256=PG8SyXuwXvRmgWLEkF8i7bgn8pcvznin7opzTMFKEkM,396
6
- skyvern_llamaindex-0.0.5.dist-info/METADATA,sha256=qhOISJr-RsdWZMQRP2mKDIcJN3EoR9GbrLxhVmHj6Ak,10539
7
- skyvern_llamaindex-0.0.5.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
8
- skyvern_llamaindex-0.0.5.dist-info/RECORD,,