Table of Contents

Class UserPromptRewriteService

Namespace
FoundationaLLM.Orchestration.Core.Services
Assembly
FoundationaLLM.Orchestration.Core.dll

Provides a service for managing the semantic cache.

public class UserPromptRewriteService : IUserPromptRewriteService
Inheritance
UserPromptRewriteService
Implements
Inherited Members
Extension Methods

Constructors

UserPromptRewriteService(IEnumerable<IResourceProviderService>, ITemplatingService, IConfiguration, ILogger<UserPromptRewriteService>)

Initializes a new instance of the UserPromptRewriteService class.

public UserPromptRewriteService(IEnumerable<IResourceProviderService> resourceProviderServices, ITemplatingService templatingService, IConfiguration configuration, ILogger<UserPromptRewriteService> logger)

Parameters

resourceProviderServices IEnumerable<IResourceProviderService>

A list of IResourceProviderService resource providers hashed by resource provider name.

templatingService ITemplatingService

The templating service used for replacing variables in prompts.

configuration IConfiguration

The IConfiguration used to retrieve app settings from configuration.

logger ILogger<UserPromptRewriteService>

The logger used for logging..

Methods

HasUserPromptRewriterForAgent(string, string)

Determines whether user prompt rewrite is configured for the specified agent in the specified FoundationaLLM instance.

public bool HasUserPromptRewriterForAgent(string instanceId, string agentName)

Parameters

instanceId string

The unique identifier of the FoundationaLLM instance.

agentName string

The name of the agent.

Returns

bool

if the user prompt rewrite for the specified agent is configured, otherwise.

InitializeUserPromptRewriterForAgent(string, string, AgentUserPromptRewriteSettings)

Initializes user prompt rewrite for the specified agent in the specified FoundationaLLM instance.

public Task InitializeUserPromptRewriterForAgent(string instanceId, string agentName, AgentUserPromptRewriteSettings agentSettings)

Parameters

instanceId string

The unique identifier of the FoundationaLLM instance.

agentName string

The name of the agent.

agentSettings AgentUserPromptRewriteSettings

The AgentUserPromptRewriteSettings providing the agent's user prompt rewrite settings.

Returns

Task

RewriteUserPrompt(string, string, CompletionRequest)

Rewrites the user prompt to a form that can be used by the AI model.

public Task RewriteUserPrompt(string instanceId, string agentName, CompletionRequest completionRequest)

Parameters

instanceId string

The unique identifier of the FoundationaLLM instance.

agentName string

The name of the agent.

completionRequest CompletionRequest

The CompletionRequest for which to rewrite the user prompt.

Returns

Task

The rewritten user prompt.