oocana 0.16.7__py3-none-any.whl → 0.16.9__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.
oocana/__init__.py CHANGED
@@ -3,5 +3,6 @@ from .context import * # noqa: F403
3
3
  from .service import * # noqa: F403
4
4
  from .handle_data import * # noqa: F403
5
5
  from .preview import * # noqa: F403
6
+ from .extra import * # noqa: F403
6
7
  from .schema import * # noqa: F403
7
- from .mainframe import Mainframe as Mainframe # noqa: F403
8
+ from .mainframe import Mainframe as Mainframe # noqa: F403
oocana/context.py CHANGED
@@ -278,7 +278,7 @@ class Context:
278
278
  if isinstance(df, ShapeDataFrame):
279
279
  row_count = df.shape[0]
280
280
  if row_count <= 10:
281
- data = df.to_dict(orient='split')
281
+ data = loads(df.to_json(orient='split'))
282
282
  columns = data.get("columns", [])
283
283
  rows = data.get("data", [])
284
284
  if not_default_index(df):
@@ -287,8 +287,9 @@ class Context:
287
287
  columns = ["", *columns]
288
288
 
289
289
  elif isinstance(df, PartialDataFrame):
290
- need_add_index = not_default_index(df)
291
- head_data = df.head(5).to_dict(orient='split')
290
+ need_add_index = False # TODO: some index is not begin with 0, current just always hide index
291
+ # to_json will serialize some default json dumps not supported type like datetime, so we just use to_json for now.
292
+ head_data = loads(df.head(5).to_json(orient='split'))
292
293
  columns = head_data.get("columns", [])
293
294
 
294
295
  rows_head = head_data.get("data", [])
@@ -297,7 +298,7 @@ class Context:
297
298
  head_index = head_data.get("index", [])
298
299
  rows_head = [[head_index[i], *rows_head[i]] for i in range(len(rows_head))]
299
300
 
300
- tail_data = df.tail(5).to_dict(orient='split')
301
+ tail_data = loads(df.tail(5).to_json(orient='split'))
301
302
  rows_tail = tail_data.get("data", [])
302
303
  if need_add_index:
303
304
  tail_index = tail_data.get("index", [])
oocana/extra.py ADDED
@@ -0,0 +1,13 @@
1
+ from typing import Literal, TypedDict
2
+
3
+ __all__ = ["LLMModelOptions", "LLMMessage"]
4
+
5
+ class LLMModelOptions(TypedDict):
6
+ model: str
7
+ temperature: float
8
+ top_p: float
9
+ max_tokens: int
10
+
11
+ class LLMMessage(TypedDict):
12
+ role: Literal["system", "user", "assistant"]
13
+ content: str
oocana/preview.py CHANGED
@@ -22,6 +22,9 @@ class DataFrame(Protocol):
22
22
  def index(self) -> DataFrameIndex:
23
23
  ...
24
24
 
25
+ def to_json(self, orient: Literal["split"]) -> str:
26
+ ...
27
+
25
28
  def to_dict(self, orient: Literal["split"]) -> Any:
26
29
  ...
27
30
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oocana
3
- Version: 0.16.7
3
+ Version: 0.16.9
4
4
  Summary: python implement of oocana to give a context for oocana block
5
5
  License: MIT
6
6
  Requires-Python: >=3.9
@@ -0,0 +1,14 @@
1
+ oocana-0.16.9.dist-info/METADATA,sha256=G_tNXd71n6dTXHfvfkCZkNE6OhGlTDKXNNcXvgzTTS4,221
2
+ oocana-0.16.9.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
+ oocana-0.16.9.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
+ oocana/__init__.py,sha256=kuZa-aY4bqStH_15K4KL9hjOeO9d-M9mJYKs4fm3n08,317
5
+ oocana/context.py,sha256=5wWUZr4BjojizFH-9yeadWvIpiUt2v7wUN3b7y34CFc,14677
6
+ oocana/data.py,sha256=0KpJyckz_X5JbrncBRFbOaU00CxcDx2UYHk6xuH1Poc,2890
7
+ oocana/extra.py,sha256=1f7cu0QA3jnb6PJtEDXMsQOSGWtjUhsRz82DaPRyjKY,289
8
+ oocana/handle_data.py,sha256=p0iEvdsVV3BqcelM8rvq0a_VPI52SeahaGCszfhZ0TI,1927
9
+ oocana/mainframe.py,sha256=Jixk9PjvJh7PnYwPGqOR5viwcOHWfaPhEiQFNHxHCxw,5219
10
+ oocana/preview.py,sha256=qJEoBQWno0BkuU501vd16VwE0okTC3PydFc_jpkwc98,2096
11
+ oocana/schema.py,sha256=8LwMaW4eXa3EmKxR4kzyTOpZiClMRMMsMA6f9CXodW4,4332
12
+ oocana/service.py,sha256=dPCcScQfMBlEjIodFnKU17-HlbBzrQbQK6CNRw7SmOE,2442
13
+ oocana/throtter.py,sha256=xTldm2OZ5uYPiyC6Aatug4FJAoMylPjtXftxHvSr_50,1104
14
+ oocana-0.16.9.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- oocana-0.16.7.dist-info/METADATA,sha256=0_TpqDCVlfykzajr-HwTAb9844PjjmtNY9SiL93krig,221
2
- oocana-0.16.7.dist-info/WHEEL,sha256=tSfRZzRHthuv7vxpI4aehrdN9scLjk-dCJkPLzkHxGg,90
3
- oocana-0.16.7.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
- oocana/__init__.py,sha256=zMrQ1asZoRE91-BShf1v2ibdThaMc07YtZt5iNbbxsg,281
5
- oocana/context.py,sha256=LyavX-bgqWGmQkLmE-_QNCd3aHWesShEJJToi4fc32U,14466
6
- oocana/data.py,sha256=0KpJyckz_X5JbrncBRFbOaU00CxcDx2UYHk6xuH1Poc,2890
7
- oocana/handle_data.py,sha256=p0iEvdsVV3BqcelM8rvq0a_VPI52SeahaGCszfhZ0TI,1927
8
- oocana/mainframe.py,sha256=Jixk9PjvJh7PnYwPGqOR5viwcOHWfaPhEiQFNHxHCxw,5219
9
- oocana/preview.py,sha256=xTyVtf5mKMVlXRwz3JSB-n4e_6dlxalkE341nUDwtD4,2027
10
- oocana/schema.py,sha256=8LwMaW4eXa3EmKxR4kzyTOpZiClMRMMsMA6f9CXodW4,4332
11
- oocana/service.py,sha256=dPCcScQfMBlEjIodFnKU17-HlbBzrQbQK6CNRw7SmOE,2442
12
- oocana/throtter.py,sha256=xTldm2OZ5uYPiyC6Aatug4FJAoMylPjtXftxHvSr_50,1104
13
- oocana-0.16.7.dist-info/RECORD,,