Skip to content

Commit

Permalink
fix: Update default typings to include enabled. (#680)
Browse files Browse the repository at this point in the history
BEGIN_COMMIT_OVERRIDE
fix: Update default typings to include enabled.
feat: Include temperature and maxTokens in LDModelConfig.
END_COMMIT_OVERRIDE
  • Loading branch information
kinyoklion authored Nov 12, 2024
1 parent a7d6b99 commit 978dfa9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/sdk/server-ai/src/api/LDAIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ import { LDContext } from '@launchdarkly/js-server-sdk-common';
import { LDAIConfig, LDGenerationConfig } from './config/LDAIConfig';

/**
* Interface for performing AI operations using LaunchDarkly.
* Interface for default model configuration.
*/
export interface LDAIDefaults extends LDGenerationConfig {
/**
* Whether the configuration is enabled.
*/
enabled?: boolean;
}

/**
* Interface for performing AI operations using LaunchDarkly.
*/
export interface LDAIClient {
/**
* Parses and interpolates a template string with the provided variables.
Expand Down Expand Up @@ -68,7 +77,7 @@ export interface LDAIClient {
* }
* ```
*/
modelConfig<TDefault extends LDGenerationConfig>(
modelConfig<TDefault extends LDAIDefaults>(
key: string,
context: LDContext,
defaultValue: TDefault,
Expand Down
11 changes: 11 additions & 0 deletions packages/sdk/server-ai/src/api/config/LDAIConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ export interface LDModelConfig {
*/
modelId?: string;

/**
* Tuning parameter for randomness versus determinism. Exact effect will be determined by the
* model.
*/
temperature?: number;

/**
* The maximum number of tokens.
*/
maxTokens?: number;

/**
* And additional model specific information.
*/
Expand Down

0 comments on commit 978dfa9

Please sign in to comment.