tinybird 0.0.1.dev240__py3-none-any.whl → 0.0.1.dev241__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.

Potentially problematic release.


This version of tinybird might be problematic. Click here for more details.

tinybird/tb/__cli__.py CHANGED
@@ -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.dev240'
8
- __revision__ = '268407c'
7
+ __version__ = '0.0.1.dev241'
8
+ __revision__ = 'b44ab3b'
@@ -21,8 +21,8 @@ from tinybird.prompts import (
21
21
  s3_connection_example,
22
22
  sink_pipe_instructions,
23
23
  )
24
+ from tinybird.tb.client import TinyB
24
25
  from tinybird.tb.modules.agent.banner import display_banner
25
- from tinybird.tb.modules.agent.client import TinybirdClient
26
26
  from tinybird.tb.modules.agent.memory import clear_history, load_history
27
27
  from tinybird.tb.modules.agent.models import create_model
28
28
  from tinybird.tb.modules.agent.prompts import datafile_instructions, plan_instructions, sql_instructions
@@ -134,10 +134,12 @@ Today is {datetime.now().strftime("%Y-%m-%d")}
134
134
  return self.messages[-5:] if len(self.messages) > 5 else self.messages
135
135
 
136
136
  def run(self, user_prompt: str) -> None:
137
+ client = TinyB(token=self.token, host=self.host)
137
138
  result = self.agent.run_sync(
138
139
  user_prompt,
139
140
  deps=TinybirdAgentContext(
140
- client=TinybirdClient(token=self.token, host=self.host),
141
+ # context does not support the whole client, so we need to pass only the functions we need
142
+ explore_data=client.explore_data,
141
143
  folder=self.folder,
142
144
  ),
143
145
  message_history=self.messages,
@@ -6,7 +6,7 @@ from pydantic_ai.providers.anthropic import AnthropicProvider
6
6
 
7
7
  def create_model(
8
8
  token: str,
9
- base_url: str = "https://api.wadus3.aws.tinybird.co",
9
+ base_url: str,
10
10
  model: AnthropicModelName = "claude-4-sonnet-20250514",
11
11
  ):
12
12
  client = AsyncAnthropic(
@@ -12,4 +12,4 @@ def explore_data(ctx: RunContext[TinybirdAgentContext], prompt: str):
12
12
  Returns:
13
13
  str: The result of the exploration.
14
14
  """
15
- return ctx.deps.client.explore_data(prompt)
15
+ return ctx.deps.explore_data(prompt)
@@ -1,6 +1,6 @@
1
1
  import os
2
2
  from contextlib import contextmanager
3
- from typing import Any, List, Optional
3
+ from typing import Any, Callable, List, Optional
4
4
 
5
5
  import click
6
6
  from prompt_toolkit.application import Application, get_app
@@ -16,11 +16,9 @@ from prompt_toolkit.shortcuts import PromptSession
16
16
  from prompt_toolkit.styles import Style
17
17
  from pydantic import BaseModel, Field
18
18
 
19
- from tinybird.tb.modules.agent.client import TinybirdClient
20
-
21
19
 
22
20
  class TinybirdAgentContext(BaseModel):
23
- client: TinybirdClient
21
+ explore_data: Callable[[str], str]
24
22
  folder: str
25
23
 
26
24
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: tinybird
3
- Version: 0.0.1.dev240
3
+ Version: 0.0.1.dev241
4
4
  Summary: Tinybird Command Line Tool
5
5
  Home-page: https://www.tinybird.co/docs/forward/commands
6
6
  Author: Tinybird
@@ -17,7 +17,7 @@ tinybird/datafile/exceptions.py,sha256=8rw2umdZjtby85QbuRKFO5ETz_eRHwUY5l7eHsy1w
17
17
  tinybird/datafile/parse_connection.py,sha256=tRyn2Rpr1TeWet5BXmMoQgaotbGdYep1qiTak_OqC5E,1825
18
18
  tinybird/datafile/parse_datasource.py,sha256=ssW8QeFSgglVFi3sDZj_HgkJiTJ2069v2JgqnH3CkDE,1825
19
19
  tinybird/datafile/parse_pipe.py,sha256=xf4m0Tw44QWJzHzAm7Z7FwUoUUtr7noMYjU1NiWnX0k,3880
20
- tinybird/tb/__cli__.py,sha256=OB0M6HqPur6rsd93Mf9BRpLf5zvrZ_aq4HvYd7nAacc,247
20
+ tinybird/tb/__cli__.py,sha256=QWlsNI8ondzuZlYrE_y6bh1Cfz6_5AfBIndh4z9wk60,247
21
21
  tinybird/tb/check_pypi.py,sha256=Gp0HkHHDFMSDL6nxKlOY51z7z1Uv-2LRexNTZSHHGmM,552
22
22
  tinybird/tb/cli.py,sha256=FdDFEIayjmsZEVsVSSvRiVYn_FHOVg_zWQzchnzfWho,1008
23
23
  tinybird/tb/client.py,sha256=pJbdkWMXGAqKseNAvdsRRnl_c7I-DCMB0dWCQnG82nU,54146
@@ -63,16 +63,15 @@ tinybird/tb/modules/watch.py,sha256=No0bK1M1_3CYuMaIgylxf7vYFJ72lTJe3brz6xQ-mJo,
63
63
  tinybird/tb/modules/workspace.py,sha256=Q_8HcxMsNg8QG9aBlwcWS2umrDP5IkTIHqqz3sfmGuc,11341
64
64
  tinybird/tb/modules/workspace_members.py,sha256=5JdkJgfuEwbq-t6vxkBhYwgsiTDxF790wsa6Xfif9nk,8608
65
65
  tinybird/tb/modules/agent/__init__.py,sha256=i3oe3vDIWWPaicdCM0zs7D7BJ1W0k7th93ooskHAV00,54
66
- tinybird/tb/modules/agent/agent.py,sha256=98X8rqUszArhOnrWWGAJRNwAK-me6Ql2UGNGFxcuc2E,10205
66
+ tinybird/tb/modules/agent/agent.py,sha256=nUvSfgi7OdrWXRxLjLHzepsrICiduAZcW7iFE0x5Q5A,10323
67
67
  tinybird/tb/modules/agent/banner.py,sha256=KX_e467uiy1gWOZ4ofTZt0GCFGQqHQ_8Ob27XLQqda0,3053
68
- tinybird/tb/modules/agent/client.py,sha256=ZNE_0xtbrfhXXRZ7nx3Ze0gHb1IK7zXRLTlGudAAuUg,1264
69
68
  tinybird/tb/modules/agent/memory.py,sha256=H6SJK--2L5C87B7AJd_jMqsq3sCvFvZwZXmajuT0GBE,1171
70
- tinybird/tb/modules/agent/models.py,sha256=jUEO7i_JwlQVZi6QEUeGyFJMFkPZ4ikyDZdei6s6f3M,628
69
+ tinybird/tb/modules/agent/models.py,sha256=mf8dRCdof6uEFZWh5xQ_D_FStk7eDds7qWRNSbDklUM,589
71
70
  tinybird/tb/modules/agent/prompts.py,sha256=j7nkx1E2BnPP6Ra718FvSDGRWucyFgSX07V9QAiaiGg,4864
72
- tinybird/tb/modules/agent/utils.py,sha256=E785Sq_TLVBi1gaBR53YlHvyP_Kbh4TmRouYl3KHFpo,13080
71
+ tinybird/tb/modules/agent/utils.py,sha256=BWbS8m8HYrbbm1OnH7kLYLxL37-q1yVKa1ObWw7klfc,13041
73
72
  tinybird/tb/modules/agent/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
73
  tinybird/tb/modules/agent/tools/create_datafile.py,sha256=06HK33h86T1d54zvnJXJz_1su3zIS7UJDPyBqhgo81c,1771
75
- tinybird/tb/modules/agent/tools/explore.py,sha256=iEVsi85CRPCPhWcl-fC1J4hYK22TfunxyqNu5pDxdDU,419
74
+ tinybird/tb/modules/agent/tools/explore.py,sha256=ihALc_kBcsjrKT3hZyicqyIowB0g_K3AtNNi-5uz9-8,412
76
75
  tinybird/tb/modules/agent/tools/plan.py,sha256=acMbyjqI6cN7IwmMAC8-MPNSg0PEZVKGEk2NOY4gMi8,1162
77
76
  tinybird/tb/modules/agent/tools/preview_datafile.py,sha256=e9q5fR0afApcrntzFrnuHmd10ex7MG_GM6T0Pwc9bRI,850
78
77
  tinybird/tb/modules/datafile/build.py,sha256=NFKBrusFLU0WJNCXePAFWiEDuTaXpwc0lHlOQWEJ43s,51117
@@ -95,8 +94,8 @@ tinybird/tb_cli_modules/config.py,sha256=IsgdtFRnUrkY8-Zo32lmk6O7u3bHie1QCxLwgp4
95
94
  tinybird/tb_cli_modules/exceptions.py,sha256=pmucP4kTF4irIt7dXiG-FcnI-o3mvDusPmch1L8RCWk,3367
96
95
  tinybird/tb_cli_modules/regions.py,sha256=QjsL5H6Kg-qr0aYVLrvb1STeJ5Sx_sjvbOYO0LrEGMk,166
97
96
  tinybird/tb_cli_modules/telemetry.py,sha256=Hh2Io8ZPROSunbOLuMvuIFU4TqwWPmQTqal4WS09K1A,10449
98
- tinybird-0.0.1.dev240.dist-info/METADATA,sha256=XT_HpNQ7KOTyQt5ICua7m_CWsFaKQGB0tMvg43YO4XM,1733
99
- tinybird-0.0.1.dev240.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
100
- tinybird-0.0.1.dev240.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
101
- tinybird-0.0.1.dev240.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
102
- tinybird-0.0.1.dev240.dist-info/RECORD,,
97
+ tinybird-0.0.1.dev241.dist-info/METADATA,sha256=urGByLwa4s7Sstte1j0r7UZ6iYFUmnpX4ujKWztx9II,1733
98
+ tinybird-0.0.1.dev241.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
99
+ tinybird-0.0.1.dev241.dist-info/entry_points.txt,sha256=LwdHU6TfKx4Qs7BqqtaczEZbImgU7Abe9Lp920zb_fo,43
100
+ tinybird-0.0.1.dev241.dist-info/top_level.txt,sha256=VqqqEmkAy7UNaD8-V51FCoMMWXjLUlR0IstvK7tJYVY,54
101
+ tinybird-0.0.1.dev241.dist-info/RECORD,,
@@ -1,42 +0,0 @@
1
- from dataclasses import dataclass
2
- from typing import Any, Dict, Optional
3
-
4
- import httpx
5
-
6
-
7
- @dataclass
8
- class TinybirdClient:
9
- def __init__(self, host: str, token: str):
10
- self.host = host
11
- self.token = token
12
- self.client = httpx.Client(
13
- timeout=30.0,
14
- headers={"Accept": "application/json", "User-Agent": "Python/APIClient"},
15
- )
16
- self.insights: list[str] = []
17
-
18
- def __aenter__(self):
19
- return self
20
-
21
- def __aexit__(self, exc_type, exc_val, exc_tb):
22
- self.close()
23
-
24
- def close(self):
25
- """Close the underlying HTTP client."""
26
- self.client.close()
27
-
28
- def _get(self, endpoint: str, params: Optional[Dict[str, Any]] = None) -> str:
29
- if params is None:
30
- params = {}
31
- params["token"] = self.token
32
- url = f"{self.host}{endpoint}"
33
- response = self.client.get(url, params=params)
34
- try:
35
- response.raise_for_status()
36
- except Exception as e:
37
- raise Exception(response.json().get("error", str(e))) from e
38
- return response.text
39
-
40
- def explore_data(self, prompt: str) -> str:
41
- params = {"prompt": prompt, "host": self.host, "origin": "cli"}
42
- return self._get("/v1/agents/explore", params)