Interface ILdAiClient
Represents the interface of the AI client, useful for mocking.
Namespace: LaunchDarkly.Sdk.Server.Ai.Interfaces
Assembly: LaunchDarkly.ServerSdk.Ai.dll
Syntax
public interface ILdAiClient
Methods
| Edit this page View SourceCompletionConfig(string, Context, LdAiCompletionConfigDefault, IReadOnlyDictionary<string, object>)
Retrieves a LaunchDarkly AI Completion Config identified by the given key. The return value
is an LdAiCompletionConfig, which makes the configuration available and
provides a CreateTracker method (inherited from LdAiConfig) for
generating a tracker that emits events related to model usage.
Any variables provided will be interpolated into the prompt's messages. Additionally, the current LaunchDarkly context will be available as 'ldctx' within a prompt message.
Declaration
LdAiCompletionConfig CompletionConfig(string key, Context context, LdAiCompletionConfigDefault defaultValue = null, IReadOnlyDictionary<string, object> variables = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | the AI Completion Config key |
| Context | context | the context |
| LdAiCompletionConfigDefault | defaultValue | the default config, if unable to retrieve from LaunchDarkly. When not provided, a disabled config is used as the fallback. |
| IReadOnlyDictionary<string, object> | variables | the list of variables used when interpolating the prompt |
Returns
| Type | Description |
|---|---|
| LdAiCompletionConfig | an AI Completion Config |
Config(string, Context, LdAiCompletionConfigDefault, IReadOnlyDictionary<string, object>)
Retrieves a LaunchDarkly AI Completion Config identified by the given key.
Declaration
[Obsolete("Use CompletionConfig instead.")]
LdAiCompletionConfig Config(string key, Context context, LdAiCompletionConfigDefault defaultValue = null, IReadOnlyDictionary<string, object> variables = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | the AI Completion Config key |
| Context | context | the context |
| LdAiCompletionConfigDefault | defaultValue | the default config, if unable to retrieve from LaunchDarkly |
| IReadOnlyDictionary<string, object> | variables | the list of variables used when interpolating the prompt |
Returns
| Type | Description |
|---|---|
| LdAiCompletionConfig | an AI Completion Config |
CreateTracker(string, Context)
Reconstructs a tracker from a resumption token. This enables cross-process scenarios such as deferred feedback, where a tracker's runId needs to be reused in a different process or at a later time.
The reconstructed tracker will have empty model and provider names, as these are not included in the resumption token.
Declaration
ILdAiConfigTracker CreateTracker(string resumptionToken, Context context)
Parameters
| Type | Name | Description |
|---|---|---|
| string | resumptionToken | the resumption token obtained from ResumptionToken |
| Context | context | the context to use for track events |
Returns
| Type | Description |
|---|---|
| ILdAiConfigTracker | a tracker associated with the original runId |