Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update default typings to include enabled. #680

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/sdk/server-ai/src/api/LDAIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ import { LDContext } from '@launchdarkly/js-server-sdk-common';

import { LDAIConfig, LDGenerationConfig } from './config/LDAIConfig';

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 +74,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