Skip to content

Commit

Permalink
Commenting improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
kinyoklion committed Nov 4, 2024
1 parent 817d4f0 commit 7d91ea8
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions packages/sdk/ai/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,28 @@ export interface AIClient {
interpolateTemplate(template: string, variables: Record<string, unknown>): string;

/**
* Retrieves and processes a prompt template based on the provided key, LaunchDarkly context, and variables.
* Retrieves and processes a prompt template based on the provided key, LaunchDarkly context, and
* variables.
*
* @param key - A unique identifier for the prompt template. This key is used to fetch the correct prompt from storage or configuration.
* @param context - The LaunchDarkly context object that contains relevant information about the current environment, user, or session. This context may influence how the prompt is processed or personalized.
* @param variables - A map of key-value pairs representing dynamic variables to be injected into the prompt template. The keys correspond to placeholders within the template, and the values are the corresponding replacements.
* @param defaultValue - A fallback value to be used if the prompt template associated with the key is not found or if any errors occur during processing.
* @param key - A unique identifier for the prompt template. This key is used to fetch the correct
* prompt from storage or configuration.
* @param context - The LaunchDarkly context object that contains relevant information about the
* current environment, user, or session. This context may influence how the prompt is processed
* or personalized.
* @param variables - A map of key-value pairs representing dynamic variables to be injected into
* the prompt template. The keys correspond to placeholders within the template, and the values
* are the corresponding replacements.
* @param defaultValue - A fallback value to be used if the prompt template associated with the
* key is not found or if any errors occur during processing.
*
* @returns The processed prompt after all variables have been substituted in the stored prompt template. If the prompt cannot be retrieved or processed, the `defaultValue` is returned.
* @returns The processed prompt after all variables have been substituted in the stored prompt
* template. If the prompt cannot be retrieved or processed, the `defaultValue` is returned.
*
* @example
* ```
* const key = "welcome_prompt";
* const context = {...};
* const variables = {username: 'john};
* const variables = {username: 'john'};
* const defaultValue = {};
*
* const result = modelConfig(key, context, defaultValue, variables);
Expand Down

0 comments on commit 7d91ea8

Please sign in to comment.