TemplateVariablesResource
TemplateVariablesResource ¶
TemplateVariablesResource(client: Client)
Bases: BaseResource
add_to_collection ¶
add_to_collection(template_variables: dict[str, str], collection: TemplateVariablesCollection) -> TemplateVariables
Adds a new entry to a collection. If the entry already exists, it will be returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template_variables
|
dict[str, str]
|
The template variables to add. |
required |
collection
|
TemplateVariablesCollection
|
The collection to add the entry to. |
required |
Returns:
Name | Type | Description |
---|---|---|
TemplateVariables |
TemplateVariables
|
The retrieved or created template variables object |
delete ¶
Deletes a template variables.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template_variables
|
TemplateVariables
|
The template variables to delete. |
required |
collection
|
TemplateVariablesCollection
|
The collection containing the template variables. |
required |
Raises:
Type | Description |
---|---|
HTTPStatusError
|
If the template variables doesn't exist, belongs to a different collection, or belongs to a different project. |
delete_all ¶
Deletes all template variables for a collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection
|
TemplateVariablesCollection
|
The collection to delete all template variables for. |
required |
Raises:
Type | Description |
---|---|
HTTPStatusError
|
If the collection doesn't exist or belongs to a different project. |
generate ¶
generate(collection: TemplateVariablesCollection, prompt_template: PromptTemplate) -> TemplateVariables
Generates a new template variable in a collection using a prompt template.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection
|
TemplateVariablesCollection
|
The collection to add the generated template variable to. |
required |
prompt_template
|
PromptTemplate
|
The prompt template to use for generation. |
required |
Returns:
Name | Type | Description |
---|---|---|
TemplateVariables |
TemplateVariables
|
The newly generated template variables object. |
list ¶
list(collection: TemplateVariablesCollection) -> list[TemplateVariables]
Returns all template variables for a collection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
collection
|
TemplateVariablesCollection
|
The collection to get entries for. |
required |
Returns:
Type | Description |
---|---|
list[TemplateVariables]
|
list[TemplateVariables]: List of template variables. |
Raises:
Type | Description |
---|---|
HTTPStatusError
|
If the collection is not found |