PromptChain
Prompt_Chain utilities for data models and type definitions used throughout the maxim sdk.
AgentCost
Type definition for agent execution costs.
Attributes:
Name | Description |
---|---|
input | Cost for input tokens |
output | Cost for output tokens |
total | Total execution cost |
AgentUsage
Type definition for agent token usage statistics.
Attributes:
Name | Description |
---|---|
prompt_tokens | Number of tokens used in the prompt |
completion_tokens | Number of tokens used in the completion |
total_tokens | Total number of tokens used |
AgentResponseMeta
Type definition for agent response metadata.
Attributes:
Name | Description |
---|---|
cost | Cost breakdown for the response |
usage | Token usage statistics |
bound_variable_responses | Optional dictionary of bound variable values |
retrieved_context | Optional retrieved context string |
AgentResponse
Represents a complete agent response with metadata.
This class encapsulates both the actual response content and associated metadata including cost, usage statistics, and contextual information.
Attributes:
Name | Description |
---|---|
response | The actual response text from the agent |
meta | Metadata about the response including costs and usage |
from_dict
Create an AgentResponse instance from a dictionary.
Arguments:
Name | Description |
---|---|
data | Dictionary containing response and meta fields |
Returns:
Name | Description |
---|---|
[AgentResponse](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |
PromptNode
Node containing a prompt in a prompt chain.
This node type wraps a Prompt object and represents a step in the chain that executes a prompt.
Attributes:
Name | Description |
---|---|
prompt | The Prompt object to be executed |
CodeBlockNode
Node containing executable code in a prompt chain.
This node type contains code that can be executed as part of the prompt chain workflow.
Attributes:
Name | Description |
---|---|
code | The code string to be executed |
ApiParams
Parameters for API node configuration.
Attributes:
Name | Description |
---|---|
id | Unique identifier for the parameter |
key | Parameter key name |
value | Parameter value |
ApiNode
Node containing API configuration in a prompt chain.
This node type wraps API configuration and represents a step in the chain that makes an API call.
Attributes:
Name | Description |
---|---|
api | Dictionary containing API configuration |
Node
Generic node in a prompt chain.
A Node represents a single step in a prompt chain and can contain different types of content (prompt, code, or API configuration).
Attributes:
Name | Description |
---|---|
order | Execution order of this node in the chain |
content | The actual content (PromptNode, CodeBlockNode, or ApiNode) |
from_dict
Create a Node instance from a dictionary.
Arguments:
Name | Description |
---|---|
data | Dictionary containing order and content type fields |
Returns:
Name | Description |
---|---|
[Node](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |
PromptChain
Complete prompt chain with versioning information.
A PromptChain represents a complete workflow consisting of multiple nodes that are executed in sequence. Each chain has versioning information for tracking changes over time.
Attributes:
Name | Description |
---|---|
prompt_chain_id | Unique identifier for the prompt chain |
version | Version number of this chain |
version_id | Unique identifier for this specific version |
nodes | List of nodes that make up the chain |
from_dict
Create a PromptChain instance from a dictionary.
Arguments:
Name | Description |
---|---|
data | Dictionary containing prompt chain data |
Returns:
Name | Description |
---|---|
[PromptChain](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |
PromptChainVersionConfig
Configuration for a specific prompt chain version.
Contains the actual configuration data (nodes) for a particular version of a prompt chain.
Attributes:
Name | Description |
---|---|
nodes | List of nodes in this version configuration |
from_dict
Create a PromptChainVersionConfig instance from a dictionary.
Arguments:
Name | Description |
---|---|
data | Dictionary containing version configuration data |
Returns:
Name | Description |
---|---|
[PromptChainVersionConfig](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |
PromptChainVersion
Specific version of a prompt chain with metadata.
Represents a particular version of a prompt chain including its configuration, description, and timestamps.
Attributes:
Name | Description |
---|---|
id | Unique identifier for this version |
version | Version number |
promptChainId | ID of the parent prompt chain |
description | Optional description of this version |
config | Optional configuration for this version |
createdAt | Timestamp when this version was created |
updatedAt | Timestamp when this version was last updated |
from_dict
Create a PromptChainVersion instance from a dictionary.
Arguments:
Name | Description |
---|---|
data | Dictionary containing version data |
Returns:
Name | Description |
---|---|
[PromptChainVersion](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |
PromptChainRuleType
Individual rule for prompt chain deployment logic.
Defines a single rule that can be used to determine which version of a prompt chain should be deployed based on various conditions.
Attributes:
Name | Description |
---|---|
field | The field to evaluate in the rule |
value | The value to compare against (can be various types including None) |
operator | The comparison operator to use |
valueSource | Optional source of the value |
exactMatch | Optional flag for exact matching |
value
adding None here
from_dict
Create a PromptChainRuleType instance from a dictionary.
Arguments:
Name | Description |
---|---|
obj | Dictionary containing rule data |
Returns:
Name | Description |
---|---|
[PromptChainRuleType](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |
PromptChainRuleGroupType
Group of rules with a combinator for prompt chain deployment logic.
Allows grouping multiple rules together with logical operators (AND/OR) to create complex deployment conditions.
Attributes:
Name | Description |
---|---|
rules | List of rules or nested rule groups |
combinator | Logical operator to combine rules (“and” or “or”) |
from_dict
Create a PromptChainRuleGroupType instance from a dictionary.
Arguments:
Name | Description |
---|---|
obj | Dictionary containing rule group data |
Returns:
Name | Description |
---|---|
[PromptChainRuleGroupType](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |
PromptChainDeploymentRules
Deployment rules for a specific prompt chain version.
Defines the conditions under which a particular version of a prompt chain should be deployed or used.
Attributes:
Name | Description |
---|---|
version | The version number these rules apply to |
query | Optional rule group that defines the deployment conditions |
from_dict
Create a PromptChainDeploymentRules instance from a dictionary.
Arguments:
Name | Description |
---|---|
obj | Dictionary containing deployment rules data |
Returns:
Name | Description |
---|---|
[PromptChainDeploymentRules](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |
VersionSpecificDeploymentConfig
Configuration for deploying a specific version.
Contains deployment configuration including rules, timestamps, and fallback information for a particular version.
Attributes:
Name | Description |
---|---|
id | Unique identifier for this deployment configuration |
timestamp | When this configuration was created |
rules | The deployment rules for this configuration |
isFallback | Whether this is a fallback configuration |
from_dict
Create a VersionSpecificDeploymentConfig instance from a dictionary.
Arguments:
Name | Description |
---|---|
obj | Dictionary containing deployment configuration data |
Returns:
Name | Description |
---|---|
[VersionSpecificDeploymentConfig](/sdk/python/references/models/prompt) | New instance created from the dictionary data |
PromptChainVersionsAndRules
Container for prompt chain versions and their deployment rules.
Aggregates all versions of a prompt chain along with their associated deployment rules and folder organization.
Attributes:
Name | Description |
---|---|
folderId | ID of the folder containing this prompt chain |
rules | Dictionary mapping rule IDs to lists of deployment configurations |
versions | List of all available versions |
fallbackVersion | Optional fallback version to use when rules don’t match |
from_dict
Create a PromptChainVersionsAndRules instance from a dictionary.
Arguments:
Name | Description |
---|---|
obj | Dictionary containing versions and rules data |
Returns:
Name | Description |
---|---|
[PromptChainVersionsAndRules](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |
VersionAndRulesWithPromptChainId
Extension of PromptChainVersionsAndRules that includes the prompt chain ID.
Provides the same functionality as PromptChainVersionsAndRules but also includes the prompt chain identifier for complete context.
Attributes:
Name | Description |
---|---|
promptChainId | Unique identifier of the prompt chain |
Inherits all attributes from PromptChainVersionsAndRules
from_dict
Create a VersionAndRulesWithPromptChainId instance from a dictionary.
Arguments:
Name | Description |
---|---|
obj | Dictionary containing versions, rules, and prompt chain ID data |
Returns:
Name | Description |
---|---|
[VersionAndRulesWithPromptChainId](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |
MaximApiPromptChainResponse
Response wrapper for single prompt chain API calls.
Encapsulates the response from API calls that return information about a single prompt chain, including error handling.
Attributes:
Name | Description |
---|---|
data | The prompt chain versions and rules data |
error | Optional error information if the API call failed |
from_dict
Create a MaximApiPromptChainResponse instance from a dictionary.
Arguments:
Name | Description |
---|---|
data | Dictionary containing API response data |
Returns:
Name | Description |
---|---|
[MaximApiPromptChainResponse](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |
PromptChainWithId
Prompt chain versions and rules with associated prompt chain ID.
Similar to VersionAndRulesWithPromptChainId but used in different contexts. Contains all version and rule information along with the prompt chain identifier.
Attributes:
Name | Description |
---|---|
promptChainId | Unique identifier of the prompt chain |
Inherits all attributes from PromptChainVersionsAndRules
from_dict
Create a PromptChainWithId instance from a dictionary.
Arguments:
Name | Description |
---|---|
obj | Dictionary containing prompt chain data with ID |
Returns:
Name | Description |
---|---|
[PromptChainWithId](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |
VersionAndRulesWithPromptChainIdEncoder
Custom JSON encoder for VersionAndRulesWithPromptChainId objects.
Provides serialization support for VersionAndRulesWithPromptChainId instances by converting them to dictionaries.
default
Convert VersionAndRulesWithPromptChainId objects to dictionaries.
Arguments:
Name | Description |
---|---|
o | Object to encode |
Returns:
Name | Description |
---|---|
dict | Dictionary representation of the object, or calls parent default |
MaximApiPromptChainsResponse
Response wrapper for multiple prompt chains API calls.
Encapsulates the response from API calls that return information about multiple prompt chains, including error handling.
Attributes:
Name | Description |
---|---|
data | List of prompt chains with their versions and rules |
error | Optional error information if the API call failed |
from_dict
Create a MaximApiPromptChainsResponse instance from a dictionary.
Arguments:
Name | Description |
---|---|
incoming_data | Dictionary containing API response data for multiple chains |
Returns:
Name | Description |
---|---|
[MaximApiPromptChainsResponse](/sdk/python/references/models/prompt_chain) | New instance created from the dictionary data |