Skip to content

Commit

Permalink
updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DoKu88 committed Nov 20, 2024
1 parent 2aa1ce6 commit 12959b7
Showing 1 changed file with 68 additions and 6 deletions.
74 changes: 68 additions & 6 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,78 @@
"deprecated": false
}
},
"/trackers/track_lm": {
"post": {
"tags": [
"trackers"
],
"summary": "track_lm",
"description": "Track a language model interaction within the current trace.\nAutomatically detects whether to use sync or _async tracking.\n\nArgs:\n messages (List[Dict[str, str]]): List of message dictionaries containing the conversation.\n Each message should have:\n - 'role': str - The role of the speaker (e.g., \"user\", \"assistant\", \"system\")\n - 'content': str - The content of the message\n\n model_name (str): Name of the language model being used\n Examples: \"gpt-4\", \"gpt-3.5-turbo\", \"claude-3-opus-20240229\"\n\n finetune (bool, optional): Whether this interaction is part of a fine-tuning process.\n Defaults to False.\n\nRaises:\n RuntimeError: If called outside a traced context (use with @trace_system_sync \n or @trace_system_async decorator)\n TypeError: If messages or model_name are not of the correct type\n\nExample:\n ```python\n @trace_system_sync(origin=\"agent\", event_type=\"chat\")\n def process_chat(self, user_input: str):\n messages = [\n {\"role\": \"user\", \"content\": user_input}\n ]\n SynthTracker.track_lm(\n messages=messages,\n model_name=\"gpt-4\"\n )\n ```\n\n**Function Signature:** `track_lm(cls, messages, model_name, finetune)`\n\n[View source on GitHub](https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/trackers.py#L204)",
"externalDocs": {
"description": "View source on GitHub",
"url": "https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/trackers.py#L204"
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"properties": {
"result": {
"type": "string"
}
},
"type": "object"
}
}
}
}
},
"deprecated": false
}
},
"/trackers/track_state": {
"post": {
"tags": [
"trackers"
],
"summary": "track_state",
"description": "Track a state change or variable value within the current trace.\nAutomatically detects whether to use sync or _async tracking.\n\nArgs:\n variable_name (str): Name of the variable or state being tracked\n\n variable_value (Union[BaseModel, str, dict, int, float, bool, list, None]): \n Value to track. Must be one of the supported types:\n - BaseModel (Pydantic models)\n - Basic Python types (str, dict, int, float, bool, list)\n - None\n\n origin (Literal[\"agent\", \"environment\"]): Source of the state change\n - \"agent\": Changes from the AI/agent system\n - \"environment\": Changes from external sources/environment\n\n annotation (Optional[str], optional): Additional notes about the state change.\n Defaults to None.\n\nRaises:\n RuntimeError: If called outside a traced context (use with @trace_system_sync \n or @trace_system_async decorator)\n TypeError: If variable_value is not one of the supported types\n ValueError: If origin is not \"agent\" or \"environment\"\n\nExample:\n ```python\n @trace_system_sync(origin=\"agent\", event_type=\"process\")\n def update_state(self, new_value: dict):\n SynthTracker.track_state(\n variable_name=\"system_state\",\n variable_value=new_value,\n origin=\"agent\",\n annotation=\"Updated after processing\"\n )\n ```\n\n**Function Signature:** `track_state(cls, variable_name, variable_value, origin, annotation)`\n\n[View source on GitHub](https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/trackers.py#L254)",
"externalDocs": {
"description": "View source on GitHub",
"url": "https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/trackers.py#L254"
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"properties": {
"result": {
"type": "string"
}
},
"type": "object"
}
}
}
}
},
"deprecated": false
}
},
"/decorators/trace_system_sync": {
"post": {
"tags": [
"decorators"
],
"summary": "trace_system_sync",
"description": "Decorator for tracing synchronous functions.\n\nPurpose is to keep track of inputs and outputs for compute steps for sync functions.\n\n**Function Signature:** `trace_system_sync(origin, event_type, log_result, manage_event, increment_partition, verbose, finetune_step)`\n\n**Return Type:** `Callable`\n\n[View source on GitHub](https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/decorators.py#L45)",
"description": "Decorator for tracing synchronous functions.\n\nPurpose is to keep track of inputs and outputs for compute steps for sync functions.\n\n**Function Signature:** `trace_system_sync(origin, event_type, log_result, manage_event, increment_partition, verbose, finetune_step)`\n\n**Return Type:** `Callable`\n\n[View source on GitHub](https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/decorators.py#L42)",
"externalDocs": {
"description": "View source on GitHub",
"url": "https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/decorators.py#L45"
"url": "https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/decorators.py#L42"
},
"responses": {
"200": {
Expand Down Expand Up @@ -80,10 +142,10 @@
"decorators"
],
"summary": "trace_system_async",
"description": "Decorator for tracing asynchronous functions.\n\nPurpose is to keep track of inputs and outputs for compute steps for _async functions.\n\n**Function Signature:** `trace_system_async(origin, event_type, log_result, manage_event, increment_partition, verbose, finetune_step)`\n\n**Return Type:** `Callable`\n\n[View source on GitHub](https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/decorators.py#L250)",
"description": "Decorator for tracing asynchronous functions.\n\nPurpose is to keep track of inputs and outputs for compute steps for _async functions.\n\n**Function Signature:** `trace_system_async(origin, event_type, log_result, manage_event, increment_partition, verbose, finetune_step)`\n\n**Return Type:** `Callable`\n\n[View source on GitHub](https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/decorators.py#L247)",
"externalDocs": {
"description": "View source on GitHub",
"url": "https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/decorators.py#L250"
"url": "https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/decorators.py#L247"
},
"responses": {
"200": {
Expand Down Expand Up @@ -111,10 +173,10 @@
"decorators"
],
"summary": "trace_system",
"description": "Decorator that chooses the correct tracing method (sync or _async) based on\nwhether the wrapped function is synchronous or asynchronous.\n\nPurpose is to keep track of inputs and outputs for compute steps for both sync and _async functions.\n\n**Function Signature:** `trace_system(origin, event_type, log_result, manage_event, increment_partition, verbose)`\n\n**Return Type:** `Callable`\n\n[View source on GitHub](https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/decorators.py#L459)",
"description": "Decorator that chooses the correct tracing method (sync or _async) based on\nwhether the wrapped function is synchronous or asynchronous.\n\nPurpose is to keep track of inputs and outputs for compute steps for both sync and _async functions.\n\n**Function Signature:** `trace_system(origin, event_type, log_result, manage_event, increment_partition, verbose)`\n\n**Return Type:** `Callable`\n\n[View source on GitHub](https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/decorators.py#L454)",
"externalDocs": {
"description": "View source on GitHub",
"url": "https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/decorators.py#L459"
"url": "https://github.com/synth-laboratories/synth-sdk/blob/main/synth_sdk/tracing/decorators.py#L454"
},
"responses": {
"200": {
Expand Down

0 comments on commit 12959b7

Please sign in to comment.