tinybird 0.0.1.dev250__tar.gz → 0.0.1.dev251__tar.gz
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.
Potentially problematic release.
This version of tinybird might be problematic. Click here for more details.
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/PKG-INFO +1 -1
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/__cli__.py +2 -2
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/agent.py +25 -8
- tinybird-0.0.1.dev251/tinybird/tb/modules/agent/tools/get_openapi_definition.py +39 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/mock.py +29 -4
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/utils.py +3 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird.egg-info/PKG-INFO +1 -1
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird.egg-info/SOURCES.txt +1 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/setup.cfg +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/__cli__.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/ch_utils/constants.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/ch_utils/engine.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/check_pypi.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/client.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/config.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/connectors.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/context.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/datafile/common.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/datafile/exceptions.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/datafile/parse_connection.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/datafile/parse_datasource.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/datafile/parse_pipe.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/datatypes.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/git_settings.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/prompts.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/sql.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/sql_template.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/sql_template_fmt.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/sql_toolset.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/syncasync.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/check_pypi.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/cli.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/client.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/config.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/__init__.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/animations.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/banner.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/memory.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/models.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/prompts.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/__init__.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/append.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/build.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/create_datafile.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/deploy.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/deploy_check.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/explore.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/get_endpoint_stats.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/plan.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/preview_datafile.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/read_fixture_data.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/build.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/build_common.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/cicd.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/cli.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/common.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/config.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/connection.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/copy.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/create.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/build.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/build_common.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/build_datasource.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/build_pipe.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/diff.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/fixture.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/format_common.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/format_datasource.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/format_pipe.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/pipe_checker.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/playground.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/pull.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datasource.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/deployment.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/deployment_common.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/deprecations.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/dev_server.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/endpoint.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/feedback_manager.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/info.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/infra.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/job.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/llm.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/llm_utils.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/local.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/local_common.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/login.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/login_common.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/logout.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/materialization.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/mock.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/mock_common.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/open.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/pipe.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/project.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/regions.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/secret.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/secret_common.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/shell.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/sink.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/table.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/test.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/token.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/watch.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/workspace.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/auth.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/branch.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/cicd.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/cli.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/common.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/config.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/connection.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/datasource.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/exceptions.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/fmt.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/job.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/pipe.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/regions.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/tag.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/telemetry.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/test.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/tinyunit/tinyunit.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/workspace.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/workspace_members.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tornado_template.py +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird.egg-info/dependency_links.txt +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird.egg-info/entry_points.txt +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird.egg-info/requires.txt +0 -0
- {tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird.egg-info/top_level.txt +0 -0
|
@@ -4,5 +4,5 @@ __description__ = 'Tinybird Command Line Tool'
|
|
|
4
4
|
__url__ = 'https://www.tinybird.co/docs/forward/commands'
|
|
5
5
|
__author__ = 'Tinybird'
|
|
6
6
|
__author_email__ = 'support@tinybird.co'
|
|
7
|
-
__version__ = '0.0.1.
|
|
8
|
-
__revision__ = '
|
|
7
|
+
__version__ = '0.0.1.dev251'
|
|
8
|
+
__revision__ = 'c11760c'
|
|
@@ -41,6 +41,7 @@ from tinybird.tb.modules.agent.tools.deploy import deploy
|
|
|
41
41
|
from tinybird.tb.modules.agent.tools.deploy_check import deploy_check
|
|
42
42
|
from tinybird.tb.modules.agent.tools.explore import explore_data
|
|
43
43
|
from tinybird.tb.modules.agent.tools.get_endpoint_stats import get_endpoint_stats
|
|
44
|
+
from tinybird.tb.modules.agent.tools.get_openapi_definition import get_openapi_definition
|
|
44
45
|
from tinybird.tb.modules.agent.tools.mock import mock
|
|
45
46
|
from tinybird.tb.modules.agent.tools.plan import plan
|
|
46
47
|
from tinybird.tb.modules.agent.tools.preview_datafile import preview_datafile
|
|
@@ -114,6 +115,7 @@ You have access to the following tools:
|
|
|
114
115
|
9. `read_fixture_data` - Read a fixture data file present in the project folder.
|
|
115
116
|
10. `append` - Append existing fixture to a datasource.
|
|
116
117
|
11. `get_endpoint_stats` - Get metrics of the requests to an endpoint.
|
|
118
|
+
12. `get_openapi_definition` - Get the OpenAPI definition for all endpoints that are built/deployed to Tinybird Cloud or Local.
|
|
117
119
|
|
|
118
120
|
# When creating or updating datafiles:
|
|
119
121
|
1. Use `plan` tool to plan the creation or update of resources.
|
|
@@ -195,6 +197,12 @@ Today is {datetime.now().strftime("%Y-%m-%d")}
|
|
|
195
197
|
Tool(
|
|
196
198
|
get_endpoint_stats, docstring_format="google", require_parameter_descriptions=True, takes_ctx=True
|
|
197
199
|
),
|
|
200
|
+
Tool(
|
|
201
|
+
get_openapi_definition,
|
|
202
|
+
docstring_format="google",
|
|
203
|
+
require_parameter_descriptions=True,
|
|
204
|
+
takes_ctx=True,
|
|
205
|
+
),
|
|
198
206
|
],
|
|
199
207
|
)
|
|
200
208
|
|
|
@@ -227,6 +235,9 @@ Today is {datetime.now().strftime("%Y-%m-%d")}
|
|
|
227
235
|
thinking_animation=thinking_animation,
|
|
228
236
|
workspace_name=self.project.workspace_name,
|
|
229
237
|
dangerously_skip_permissions=self.dangerously_skip_permissions,
|
|
238
|
+
token=self.token,
|
|
239
|
+
user_token=self.user_token,
|
|
240
|
+
host=self.host,
|
|
230
241
|
),
|
|
231
242
|
message_history=self.messages,
|
|
232
243
|
)
|
|
@@ -243,11 +254,13 @@ Today is {datetime.now().strftime("%Y-%m-%d")}
|
|
|
243
254
|
)
|
|
244
255
|
click.echo(result.output)
|
|
245
256
|
click.echo("\n")
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
257
|
+
|
|
258
|
+
if "@tinybird.co" in config.get("user_email", ""):
|
|
259
|
+
click.echo(f"Input tokens: {request_tokens}")
|
|
260
|
+
click.echo(f"Output tokens: {response_tokens}")
|
|
261
|
+
click.echo(f"Total tokens: {total_tokens}")
|
|
262
|
+
click.echo(f"Cost: ${cost:.6f}")
|
|
263
|
+
click.echo("\n")
|
|
251
264
|
|
|
252
265
|
|
|
253
266
|
def run_agent(config: dict[str, Any], project: Project, dangerously_skip_permissions: bool):
|
|
@@ -378,7 +391,12 @@ def append_data(config: dict[str, Any], datasource_name: str, path: str) -> None
|
|
|
378
391
|
|
|
379
392
|
|
|
380
393
|
def mock_data(
|
|
381
|
-
config: dict[str, Any],
|
|
394
|
+
config: dict[str, Any],
|
|
395
|
+
project: Project,
|
|
396
|
+
datasource_name: str,
|
|
397
|
+
data_format: str,
|
|
398
|
+
rows: int,
|
|
399
|
+
context: Optional[str] = None,
|
|
382
400
|
) -> list[dict[str, Any]]:
|
|
383
401
|
client = get_tinybird_local_client(config, test=False, silent=False)
|
|
384
402
|
cli_config = CLIConfig.get_project_config()
|
|
@@ -388,12 +406,11 @@ def mock_data(
|
|
|
388
406
|
raise CLIMockException(f"Datasource {datasource_name} not found")
|
|
389
407
|
|
|
390
408
|
datasource_content = Path(datasource_path).read_text()
|
|
391
|
-
prompt = ""
|
|
392
409
|
return create_mock_data(
|
|
393
410
|
datasource_name,
|
|
394
411
|
datasource_content,
|
|
395
412
|
rows,
|
|
396
|
-
|
|
413
|
+
context or "",
|
|
397
414
|
cli_config,
|
|
398
415
|
config,
|
|
399
416
|
cli_config.get_user_token() or "",
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import click
|
|
2
|
+
import requests
|
|
3
|
+
from pydantic_ai import RunContext
|
|
4
|
+
|
|
5
|
+
from tinybird.tb.modules.agent.utils import TinybirdAgentContext
|
|
6
|
+
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_openapi_definition(ctx: RunContext[TinybirdAgentContext], cloud: bool = True):
|
|
10
|
+
"""Get the OpenAPI definition for all endpoints in the project:
|
|
11
|
+
|
|
12
|
+
Args:
|
|
13
|
+
cloud (bool): Whether to get the OpenAPI spec from cloud or local. Optional.
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
str: The OpenAPI spec for all endpoints in the project.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
cloud_or_local = "Cloud" if cloud else "Local"
|
|
20
|
+
ctx.deps.thinking_animation.stop()
|
|
21
|
+
|
|
22
|
+
click.echo(FeedbackManager.highlight(message=f"» Accessing Tinybird {cloud_or_local} endpoints"))
|
|
23
|
+
try:
|
|
24
|
+
url = f"{ctx.deps.host}/v0/pipes/openapi.json"
|
|
25
|
+
|
|
26
|
+
result = requests.get(url, headers={"Authorization": f"Bearer {ctx.deps.token}"})
|
|
27
|
+
if result.status_code != 200:
|
|
28
|
+
raise Exception(f"Failed to get OpenAPI spec: {result.status_code} {result.text}")
|
|
29
|
+
|
|
30
|
+
openapi_spec = result.text
|
|
31
|
+
|
|
32
|
+
click.echo(FeedbackManager.success(message="✓ Done!"))
|
|
33
|
+
click.echo()
|
|
34
|
+
ctx.deps.thinking_animation.start()
|
|
35
|
+
return f"OpenAPI spec for {cloud_or_local} endpoints: {openapi_spec}. <dev_note>Add the base url to each path so the user can copy paste if needed: {ctx.deps.host}</dev_note>"
|
|
36
|
+
except Exception as e:
|
|
37
|
+
click.echo(FeedbackManager.error(message=f"Error getting OpenAPI spec: {e}"))
|
|
38
|
+
ctx.deps.thinking_animation.start()
|
|
39
|
+
return f"Error getting OpenAPI spec: {e}"
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
import click
|
|
2
4
|
from pydantic_ai import RunContext
|
|
3
5
|
|
|
@@ -6,13 +8,20 @@ from tinybird.tb.modules.datafile.fixture import persist_fixture
|
|
|
6
8
|
from tinybird.tb.modules.feedback_manager import FeedbackManager
|
|
7
9
|
|
|
8
10
|
|
|
9
|
-
def mock(
|
|
11
|
+
def mock(
|
|
12
|
+
ctx: RunContext[TinybirdAgentContext],
|
|
13
|
+
datasource_name: str,
|
|
14
|
+
data_format: str,
|
|
15
|
+
rows: int,
|
|
16
|
+
context: Optional[str] = None,
|
|
17
|
+
) -> str:
|
|
10
18
|
"""Create mock data for a datasource
|
|
11
19
|
|
|
12
20
|
Args:
|
|
13
21
|
datasource_name: Name of the datasource to create mock data for
|
|
14
22
|
data_format: Format of the mock data to create. Options: ndjson, csv
|
|
15
23
|
rows: Number of rows to create. If not provided, the default is 10
|
|
24
|
+
context: Extra context to be used to generate the mock data. Optional.
|
|
16
25
|
|
|
17
26
|
Returns:
|
|
18
27
|
str: Message indicating the success or failure of the mock data generation
|
|
@@ -35,7 +44,7 @@ def mock(ctx: RunContext[TinybirdAgentContext], datasource_name: str, data_forma
|
|
|
35
44
|
return "User cancelled mock data generation. Stop mock data generation."
|
|
36
45
|
|
|
37
46
|
click.echo(FeedbackManager.highlight(message=f"\n» Generating mock data for {datasource_name}..."))
|
|
38
|
-
data = ctx.deps.mock_data(datasource_name=datasource_name, data_format=data_format, rows=rows)
|
|
47
|
+
data = ctx.deps.mock_data(datasource_name=datasource_name, data_format=data_format, rows=rows, context=context)
|
|
39
48
|
fixture_path = persist_fixture(datasource_name, data, ctx.deps.folder, format=data_format)
|
|
40
49
|
ctx.deps.append_data(datasource_name=datasource_name, path=str(fixture_path))
|
|
41
50
|
click.echo(FeedbackManager.success(message=f"✓ Data generated for {datasource_name}"))
|
|
@@ -43,6 +52,22 @@ def mock(ctx: RunContext[TinybirdAgentContext], datasource_name: str, data_forma
|
|
|
43
52
|
return f"Mock data generated successfully for datasource {datasource_name}"
|
|
44
53
|
except Exception as e:
|
|
45
54
|
ctx.deps.thinking_animation.stop()
|
|
46
|
-
|
|
55
|
+
error_message = str(e)
|
|
56
|
+
click.echo(FeedbackManager.error(message=error_message))
|
|
57
|
+
try:
|
|
58
|
+
if "in quarantine" in error_message:
|
|
59
|
+
click.echo(
|
|
60
|
+
FeedbackManager.highlight(message=f"\n» Looking for errors in {datasource_name}_quarantine...")
|
|
61
|
+
)
|
|
62
|
+
query = f"select * from {datasource_name}_quarantine order by insertion_date desc limit 5 FORMAT CSVWithNames"
|
|
63
|
+
quarantine_data = ctx.deps.execute_local_query(query=query)
|
|
64
|
+
error_message = (
|
|
65
|
+
error_message
|
|
66
|
+
+ f"\nThese are the first 5 rows of the quarantine table for datasource '{datasource_name}':\n{quarantine_data}. Use again `mock` tool but add this issue to the context."
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
except Exception as quarantine_error:
|
|
70
|
+
error_message = error_message + f"\nError accessing to {datasource_name}_quarantine: {quarantine_error}"
|
|
71
|
+
|
|
47
72
|
ctx.deps.thinking_animation.start()
|
|
48
|
-
return f"Error generating mock data: {
|
|
73
|
+
return f"Error generating mock data: {error_message}"
|
|
@@ -94,6 +94,7 @@ tinybird/tb/modules/agent/tools/deploy.py
|
|
|
94
94
|
tinybird/tb/modules/agent/tools/deploy_check.py
|
|
95
95
|
tinybird/tb/modules/agent/tools/explore.py
|
|
96
96
|
tinybird/tb/modules/agent/tools/get_endpoint_stats.py
|
|
97
|
+
tinybird/tb/modules/agent/tools/get_openapi_definition.py
|
|
97
98
|
tinybird/tb/modules/agent/tools/mock.py
|
|
98
99
|
tinybird/tb/modules/agent/tools/plan.py
|
|
99
100
|
tinybird/tb/modules/agent/tools/preview_datafile.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/create_datafile.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/deploy_check.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/preview_datafile.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/agent/tools/read_fixture_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/build_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/build_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/format_common.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/format_datasource.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/datafile/pipe_checker.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb/modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/tinyunit/tinyunit.py
RENAMED
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/tinyunit/tinyunit_lib.py
RENAMED
|
File without changes
|
|
File without changes
|
{tinybird-0.0.1.dev250 → tinybird-0.0.1.dev251}/tinybird/tb_cli_modules/workspace_members.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|