pub struct PromptClient { /* private fields */ }Expand description
Client for managing AI prompt templates.
Implementations§
Source§impl PromptClient
impl PromptClient
Sourcepub async fn save_prompt(
&self,
prompt_name: &str,
description: &str,
prompt_template: &str,
) -> Result<()>
pub async fn save_prompt( &self, prompt_name: &str, description: &str, prompt_template: &str, ) -> Result<()>
Creates or updates a prompt template (simplified method) This creates a new version or updates the latest version.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn save_prompt_with_options(
&self,
prompt_name: &str,
description: &str,
prompt_template: &str,
models: Option<&[String]>,
version: Option<i32>,
auto_increment: bool,
) -> Result<()>
pub async fn save_prompt_with_options( &self, prompt_name: &str, description: &str, prompt_template: &str, models: Option<&[String]>, version: Option<i32>, auto_increment: bool, ) -> Result<()>
Creates or updates a prompt template with full control over versioning and model associations.
§Arguments
prompt_name- The name of the prompt templatedescription- A description of what the prompt doesprompt_template- The template content with optional variable placeholdersmodels- Optional list of AI model names this prompt is compatible with (e.g.,["openai:gpt-4", "anthropic:sonnet-4.5"])version- Specific version number to create or update, or None to update the latest versionauto_increment- If true, automatically creates a new version instead of updating existing
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn update_prompt(
&self,
prompt_name: &str,
version: i32,
description: &str,
prompt_template: &str,
models: Option<&[String]>,
) -> Result<()>
pub async fn update_prompt( &self, prompt_name: &str, version: i32, description: &str, prompt_template: &str, models: Option<&[String]>, ) -> Result<()>
Updates an existing prompt template at a specific version.
§Arguments
prompt_name- The name of the prompt templateversion- The version number to updatedescription- A description of what the prompt doesprompt_template- The template content with optional variable placeholdersmodels- Optional list of AI model names this prompt is compatible with
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn save_prompts(
&self,
prompts: &[PromptTemplate],
new_version: bool,
) -> Result<()>
pub async fn save_prompts( &self, prompts: &[PromptTemplate], new_version: bool, ) -> Result<()>
Creates multiple prompt templates in a single bulk operation.
§Arguments
prompts- List of prompt templates to createnew_version- If true, creates new versions for existing prompts; if false, updates existing versions
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn get_prompt(&self, prompt_name: &str) -> Result<PromptTemplate>
pub async fn get_prompt(&self, prompt_name: &str) -> Result<PromptTemplate>
Retrieves the latest version of a prompt template by name.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn get_prompt_version(
&self,
prompt_name: &str,
version: i32,
) -> Result<PromptTemplate>
pub async fn get_prompt_version( &self, prompt_name: &str, version: i32, ) -> Result<PromptTemplate>
Retrieves a specific version of a prompt template.
§Arguments
prompt_name- The name of the prompt templateversion- The version number to retrieve
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn get_all_prompt_versions(
&self,
prompt_name: &str,
) -> Result<Vec<PromptTemplate>>
pub async fn get_all_prompt_versions( &self, prompt_name: &str, ) -> Result<Vec<PromptTemplate>>
Retrieves all versions of a specific prompt template.
§Arguments
prompt_name- The name of the prompt template
§Returns
List of all versions of the prompt template, ordered by version number.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn get_prompts(&self) -> Result<Vec<PromptTemplate>>
pub async fn get_prompts(&self) -> Result<Vec<PromptTemplate>>
Retrieves all prompt templates (latest versions only).
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, or an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status.
Sourcepub async fn delete_prompt(&self, prompt_name: &str) -> Result<()>
pub async fn delete_prompt(&self, prompt_name: &str) -> Result<()>
Deletes all versions of a prompt template.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, or an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status.
Sourcepub async fn delete_prompt_version(
&self,
prompt_name: &str,
version: i32,
) -> Result<()>
pub async fn delete_prompt_version( &self, prompt_name: &str, version: i32, ) -> Result<()>
Deletes a specific version of a prompt template.
§Arguments
prompt_name- The name of the prompt templateversion- The version number to delete
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, or an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status.
Retrieves all tags associated with a prompt template.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn update_tag_for_prompt_template(
&self,
prompt_name: &str,
tags: &[MetadataTag],
) -> Result<()>
pub async fn update_tag_for_prompt_template( &self, prompt_name: &str, tags: &[MetadataTag], ) -> Result<()>
Adds or updates tags for a prompt template.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, or an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status.
Sourcepub async fn delete_tag_for_prompt_template(
&self,
prompt_name: &str,
tags: &[MetadataTag],
) -> Result<()>
pub async fn delete_tag_for_prompt_template( &self, prompt_name: &str, tags: &[MetadataTag], ) -> Result<()>
Deletes specific tags from a prompt template.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.
Sourcepub async fn test_prompt(
&self,
prompt_text: &str,
variables: &HashMap<String, Value>,
ai_integration: &str,
text_complete_model: &str,
temperature: f32,
top_p: f32,
stop_words: Option<&[String]>,
) -> Result<String>
pub async fn test_prompt( &self, prompt_text: &str, variables: &HashMap<String, Value>, ai_integration: &str, text_complete_model: &str, temperature: f32, top_p: f32, stop_words: Option<&[String]>, ) -> Result<String>
Tests a prompt template by substituting variables and processing through the specified AI model.
This allows you to validate prompt templates before saving them or using them in workflows.
§Arguments
prompt_text- The text of the prompt template with variable placeholdersvariables- A map containing variables to be replaced in the templateai_integration- The name of the AI integration provider (e.g., “openai”)text_complete_model- The AI model to use for completing text (e.g., “gpt-4”)temperature- The randomness of the output, typically 0.0 to 1.0 (default is 0.1)top_p- The nucleus sampling probability mass (default is 0.9)stop_words- Optional list of words at which to stop generating further text
§Returns
The processed prompt text after variable substitution and AI model processing.
§Errors
Returns crate::error::ConductorError::Http if the request fails at the transport level, an crate::error::ConductorError::Auth/crate::error::ConductorError::Api/crate::error::ConductorError::Server variant if the server responds with a non-2xx status, or crate::error::ConductorError::Json if the response body can’t be deserialized.