mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-07-04 10:52:17 +02:00
Implement cost calculator for Tuber (#471)
* Adding cost calculation in tuner for BYOK * fix * implement cost calculator for Tuner * Update api/services/integrations/tuner/completion.py Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * feat: expose render_options in node spec * Update api/services/integrations/registry.py Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --------- Co-authored-by: mohamed salem <259547077+mohamedsalem-bot@users.noreply.github.com> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: Abhishek Kumar <abhishek@a6k.me>
This commit is contained in:
parent
97803b8121
commit
65d46bc313
16 changed files with 479 additions and 188 deletions
|
|
@ -133,6 +133,42 @@ class PropertyOption(BaseModel):
|
|||
return out
|
||||
|
||||
|
||||
class PropertyLayoutOptions(BaseModel):
|
||||
"""Renderer layout hints for a property in the node editor."""
|
||||
|
||||
column_span: Optional[int] = Field(
|
||||
default=None,
|
||||
ge=1,
|
||||
le=12,
|
||||
description="Number of columns to occupy in the editor's 12-column grid.",
|
||||
)
|
||||
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
|
||||
class NumberInputOptions(BaseModel):
|
||||
"""Renderer hints for numeric inputs."""
|
||||
|
||||
fractional: bool = Field(
|
||||
default=False,
|
||||
description="Allow arbitrary fractional values via step='any'.",
|
||||
)
|
||||
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
|
||||
class PropertyRendererOptions(BaseModel):
|
||||
"""Typed renderer metadata for node properties.
|
||||
|
||||
Add new renderer behavior here instead of using free-form property metadata.
|
||||
"""
|
||||
|
||||
layout: Optional[PropertyLayoutOptions] = None
|
||||
number_input: Optional[NumberInputOptions] = None
|
||||
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
|
||||
class PropertySpec(BaseModel):
|
||||
"""Single field on a node.
|
||||
|
||||
|
|
@ -180,8 +216,9 @@ class PropertySpec(BaseModel):
|
|||
# Renderer hint, e.g. "textarea" vs single-line for `string`.
|
||||
editor: Optional[str] = None
|
||||
|
||||
# Free-form metadata for renderer-specific behavior. Use sparingly.
|
||||
extra: dict[str, Any] = Field(default_factory=dict)
|
||||
# Typed metadata for renderer-specific behavior. Extend
|
||||
# `PropertyRendererOptions` when the renderer needs a new hint.
|
||||
renderer_options: Optional[PropertyRendererOptions] = None
|
||||
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
|
|
@ -192,7 +229,7 @@ class PropertySpec(BaseModel):
|
|||
description, llm_hint, requiredness, default, enum options, nested
|
||||
row properties, and validation bounds. UI-rendering concerns
|
||||
(`display_name`, `placeholder`, `display_options`, `editor`,
|
||||
`extra`) and null/empty fields are omitted — they're noise in the
|
||||
`renderer_options`) and null/empty fields are omitted — they're noise in the
|
||||
model's context and never appear in authored SDK code.
|
||||
"""
|
||||
out: dict[str, Any] = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue