chainfury.types module

class chainfury.types.ApiAction(*, name: str, description: str, tags: list[str] = [], fn: FnModel, outputs: list[chainfury.types.ApiAction.OutputModel])[source]

Bases: BaseModel

class FnModel(*, model_id: str, model_params: dict, fn: dict)[source]

Bases: BaseModel

fn: dict
model_id: str
model_params: dict
class OutputModel(*, type: str, name: str, loc: list[str])[source]

Bases: BaseModel

loc: list[str]
name: str
type: str
description: str
fn: FnModel
name: str
outputs: list[chainfury.types.ApiAction.OutputModel]
tags: list[str]
class chainfury.types.ApiActionUpdateRequest(*, name: str = '', description: str = '', tags: list[str] = [], fn: FnModel = None, outputs: list[chainfury.types.ApiAction.OutputModel] = [], update_fields: list[str])[source]

Bases: BaseModel

description: str
fn: FnModel
name: str
outputs: list[chainfury.types.ApiAction.OutputModel]
tags: list[str]
update_fields: list[str]
class chainfury.types.ApiAuth(*, username: str, password: str)[source]

Bases: BaseModel

password: str
username: str
class chainfury.types.ApiChain(*, name: str, dag: Dag | None = None, description: str | None = None, id: str = '', created_at: datetime | None = None, engine: str = '', update_keys: List[str] = [])[source]

Bases: BaseModel

This is the on-the-wire representation of the chain. This is used by the network to transfer chains

created_at: datetime | None
dag: Dag | None
description: str | None
engine: str
id: str
name: str
update_keys: List[str]
class chainfury.types.ApiChangePassword(*, username: str, old_password: str, new_password: str)[source]

Bases: BaseModel

new_password: str
old_password: str
username: str
class chainfury.types.ApiCreateChainRequest(*, name: str, engine: str, dag: Dag | None = None, description: str = '')[source]

Bases: BaseModel

User request to create a new chain

dag: Dag | None
description: str
engine: str
name: str
class chainfury.types.ApiListChainsResponse(*, chatbots: List[ApiChain])[source]

Bases: BaseModel

List of all the chains

chatbots: List[ApiChain]
class chainfury.types.ApiPromptBody(*, session_id: str, chat_history: List[str] = [], data: Dict[str, Any] = {}, new_message: str = '')[source]

Bases: BaseModel

This is the prompt for the API to run the chain

chat_history: List[str]
data: Dict[str, Any]
new_message: str
session_id: str
class chainfury.types.ApiPromptFeedback(*, score: int)[source]

Bases: BaseModel

score: int
class chainfury.types.ApiResponse(*, message: str)[source]

Bases: BaseModel

This is the default response body of the API

message: str
class chainfury.types.ApiSignUp(*, username: str, email: str, password: str)[source]

Bases: BaseModel

email: str
password: str
username: str
class chainfury.types.CFPromptResult(*, result: str, prompt_id: int = 0, task_id: str = '')[source]

Bases: BaseModel

This is a structured result of the prompt by the Chain. This is more useful for providing types on the server.

prompt_id: int
result: str
task_id: str
class chainfury.types.Dag(*, nodes: List[FENode], edges: List[Edge], sample: Dict[str, Any] = None, main_in: str = '', main_out: str = '')[source]

Bases: BaseModel

This is visual representation of the chain. JSON of this is stored in the DB.

edges: List[Edge]
main_in: str
main_out: str
nodes: List[FENode]
sample: Dict[str, Any]
class chainfury.types.Edge(*, id: str, source: str, sourceHandle: str, target: str, targetHandle: str)[source]

Bases: BaseModel

This is one edge of the graph

id: str
source: str
sourceHandle: str
target: str
targetHandle: str
class chainfury.types.FENode(*, cf_id: str = '', cf_data: CFData | None = None, id: str, position: Position, type: str = 'FuryEngineNode', width: int, height: int, selected: bool | None = None, position_absolute: Position | None = None, dragging: bool | None = None, data: Dict[str, Any] | None = {})[source]

Bases: BaseModel

FENode is the node as required by the UI to render the node in the graph. If you do not care about the UI, you can populate either the cf_id or cf_data.

class CFData(*, id: str, type: str, node: Dict[str, Any], value: Any = None)[source]

Bases: BaseModel

id: str
node: Dict[str, Any]
type: str
value: Any
class Position(*, x: float, y: float)[source]

Bases: BaseModel

x: float
y: float
cf_data: CFData | None
cf_id: str
data: Dict[str, Any] | None
dragging: bool | None
height: int
id: str
position: Position
position_absolute: Position | None
selected: bool | None
type: str
width: int