@launchdarkly/server-sdk-ai 0.12.3 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/README.md +2 -2
- package/__tests__/Judge.test.ts +496 -0
- package/__tests__/LDAIClientImpl.test.ts +530 -323
- package/__tests__/LDAIConfigTrackerImpl.test.ts +50 -290
- package/__tests__/TrackedChat.test.ts +4 -5
- package/dist/package.json +53 -0
- package/dist/src/LDAIClientImpl.d.ts +39 -0
- package/dist/src/LDAIClientImpl.d.ts.map +1 -0
- package/dist/src/LDAIClientImpl.js +164 -0
- package/dist/src/LDAIClientImpl.js.map +1 -0
- package/dist/{LDAIConfigTrackerImpl.d.ts → src/LDAIConfigTrackerImpl.d.ts} +13 -11
- package/dist/src/LDAIConfigTrackerImpl.d.ts.map +1 -0
- package/dist/{LDAIConfigTrackerImpl.js → src/LDAIConfigTrackerImpl.js} +59 -44
- package/dist/src/LDAIConfigTrackerImpl.js.map +1 -0
- package/dist/src/LDClientMin.d.ts.map +1 -0
- package/dist/{LDClientMin.js.map → src/LDClientMin.js.map} +1 -1
- package/dist/src/api/LDAIClient.d.ts +258 -0
- package/dist/src/api/LDAIClient.d.ts.map +1 -0
- package/dist/{api → src/api}/LDAIClient.js.map +1 -1
- package/dist/{api → src/api}/chat/TrackedChat.d.ts +22 -4
- package/dist/src/api/chat/TrackedChat.d.ts.map +1 -0
- package/dist/{api → src/api}/chat/TrackedChat.js +43 -2
- package/dist/src/api/chat/TrackedChat.js.map +1 -0
- package/dist/src/api/chat/index.d.ts.map +1 -0
- package/dist/src/api/chat/index.js.map +1 -0
- package/dist/src/api/chat/types.d.ts +22 -0
- package/dist/src/api/chat/types.d.ts.map +1 -0
- package/dist/{api → src/api}/chat/types.js.map +1 -1
- package/dist/{api → src/api}/config/LDAIConfigTracker.d.ts +41 -22
- package/dist/src/api/config/LDAIConfigTracker.d.ts.map +1 -0
- package/dist/src/api/config/LDAIConfigTracker.js.map +1 -0
- package/dist/src/api/config/LDAIConfigUtils.d.ts +2 -0
- package/dist/src/api/config/LDAIConfigUtils.d.ts.map +1 -0
- package/dist/src/api/config/LDAIConfigUtils.js +141 -0
- package/dist/src/api/config/LDAIConfigUtils.js.map +1 -0
- package/dist/src/api/config/index.d.ts +3 -0
- package/dist/src/api/config/index.d.ts.map +1 -0
- package/dist/{api/agents → src/api/config}/index.js +1 -1
- package/dist/src/api/config/index.js.map +1 -0
- package/dist/src/api/config/types.d.ts +202 -0
- package/dist/src/api/config/types.d.ts.map +1 -0
- package/dist/{api/agents/LDAIAgent.js → src/api/config/types.js} +1 -1
- package/dist/src/api/config/types.js.map +1 -0
- package/dist/{api → src/api}/index.d.ts +1 -1
- package/dist/src/api/index.d.ts.map +1 -0
- package/dist/{api → src/api}/index.js +1 -1
- package/dist/src/api/index.js.map +1 -0
- package/dist/src/api/judge/EvaluationSchemaBuilder.d.ts +11 -0
- package/dist/src/api/judge/EvaluationSchemaBuilder.d.ts.map +1 -0
- package/dist/src/api/judge/EvaluationSchemaBuilder.js +52 -0
- package/dist/src/api/judge/EvaluationSchemaBuilder.js.map +1 -0
- package/dist/src/api/judge/Judge.d.ts +63 -0
- package/dist/src/api/judge/Judge.d.ts.map +1 -0
- package/dist/src/api/judge/Judge.js +149 -0
- package/dist/src/api/judge/Judge.js.map +1 -0
- package/dist/src/api/judge/index.d.ts +3 -0
- package/dist/src/api/judge/index.d.ts.map +1 -0
- package/dist/src/api/judge/index.js +6 -0
- package/dist/src/api/judge/index.js.map +1 -0
- package/dist/src/api/judge/types.d.ts +35 -0
- package/dist/src/api/judge/types.d.ts.map +1 -0
- package/dist/{api/config/LDAIConfig.js → src/api/judge/types.js} +1 -1
- package/dist/src/api/judge/types.js.map +1 -0
- package/dist/src/api/metrics/BedrockTokenUsage.d.ts.map +1 -0
- package/dist/src/api/metrics/BedrockTokenUsage.js.map +1 -0
- package/dist/src/api/metrics/LDAIMetrics.d.ts.map +1 -0
- package/dist/src/api/metrics/LDAIMetrics.js.map +1 -0
- package/dist/src/api/metrics/LDFeedbackKind.d.ts.map +1 -0
- package/dist/src/api/metrics/LDFeedbackKind.js.map +1 -0
- package/dist/src/api/metrics/LDTokenUsage.d.ts.map +1 -0
- package/dist/src/api/metrics/LDTokenUsage.js.map +1 -0
- package/dist/src/api/metrics/OpenAiUsage.d.ts.map +1 -0
- package/dist/src/api/metrics/OpenAiUsage.js.map +1 -0
- package/dist/src/api/metrics/VercelAISDKTokenUsage.d.ts.map +1 -0
- package/dist/src/api/metrics/VercelAISDKTokenUsage.js.map +1 -0
- package/dist/src/api/metrics/index.d.ts.map +1 -0
- package/dist/src/api/metrics/index.js.map +1 -0
- package/dist/{api → src/api}/providers/AIProvider.d.ts +20 -3
- package/dist/src/api/providers/AIProvider.d.ts.map +1 -0
- package/dist/src/api/providers/AIProvider.js +88 -0
- package/dist/src/api/providers/AIProvider.js.map +1 -0
- package/dist/{api → src/api}/providers/AIProviderFactory.d.ts +2 -2
- package/dist/src/api/providers/AIProviderFactory.d.ts.map +1 -0
- package/dist/src/api/providers/AIProviderFactory.js.map +1 -0
- package/dist/src/api/providers/index.d.ts.map +1 -0
- package/dist/src/api/providers/index.js.map +1 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js.map +1 -0
- package/docs/assets/search.js +1 -1
- package/docs/classes/AIProvider.html +55 -20
- package/docs/classes/AIProviderFactory.html +27 -17
- package/docs/classes/Judge.html +322 -0
- package/docs/classes/TrackedChat.html +97 -29
- package/docs/enums/LDFeedbackKind.html +22 -12
- package/docs/functions/createBedrockTokenUsage.html +20 -10
- package/docs/functions/createOpenAiUsage.html +20 -10
- package/docs/functions/createVercelAISDKTokenUsage.html +20 -10
- package/docs/functions/initAi.html +20 -10
- package/docs/index.html +36 -16
- package/docs/interfaces/ChatResponse.html +35 -14
- package/docs/interfaces/EvalScore.html +119 -0
- package/docs/interfaces/JudgeResponse.html +129 -0
- package/docs/interfaces/LDAIAgentConfig.html +81 -33
- package/docs/interfaces/{LDAIAgent.html → LDAIAgentConfigDefault.html} +51 -41
- package/docs/interfaces/LDAIAgentRequestConfig.html +129 -0
- package/docs/interfaces/LDAIClient.html +234 -40
- package/docs/interfaces/{VercelAISDKConfig.html → LDAICompletionConfig.html} +86 -86
- package/docs/interfaces/LDAICompletionConfigDefault.html +155 -0
- package/docs/interfaces/LDAIConfig.html +45 -75
- package/docs/interfaces/LDAIConfigDefault.html +133 -0
- package/docs/interfaces/LDAIConfigTracker.html +140 -59
- package/docs/interfaces/LDAIJudgeConfig.html +167 -0
- package/docs/interfaces/LDAIJudgeConfigDefault.html +155 -0
- package/docs/interfaces/LDAIMetrics.html +22 -12
- package/docs/interfaces/LDJudge.html +119 -0
- package/docs/interfaces/{VercelAISDKMapOptions.html → LDJudgeConfiguration.html} +36 -19
- package/docs/interfaces/LDLogger.html +19 -9
- package/docs/interfaces/LDMessage.html +22 -12
- package/docs/interfaces/LDModelConfig.html +23 -13
- package/docs/interfaces/LDProviderConfig.html +21 -11
- package/docs/interfaces/LDTokenUsage.html +23 -13
- package/docs/interfaces/StructuredResponse.html +129 -0
- package/docs/types/{VercelAISDKProvider.html → LDAIConfigDefaultKind.html} +26 -31
- package/docs/types/{LDAIAgentDefaults.html → LDAIConfigKind.html} +24 -14
- package/docs/types/{LDAIDefaults.html → LDAIConfigMode.html} +24 -24
- package/docs/types/SupportedAIProvider.html +20 -10
- package/docs/variables/SUPPORTED_AI_PROVIDERS.html +20 -10
- package/package.json +3 -3
- package/src/LDAIClientImpl.ts +222 -176
- package/src/LDAIConfigTrackerImpl.ts +73 -54
- package/src/api/LDAIClient.ts +166 -33
- package/src/api/chat/TrackedChat.ts +64 -5
- package/src/api/chat/types.ts +8 -1
- package/src/api/config/LDAIConfigTracker.ts +46 -27
- package/src/api/config/LDAIConfigUtils.ts +201 -0
- package/src/api/config/index.ts +2 -2
- package/src/api/config/types.ts +256 -0
- package/src/api/index.ts +1 -1
- package/src/api/judge/EvaluationSchemaBuilder.ts +54 -0
- package/src/api/judge/Judge.ts +216 -0
- package/src/api/judge/index.ts +2 -0
- package/src/api/judge/types.ts +39 -0
- package/src/api/providers/AIProvider.ts +54 -3
- package/src/api/providers/AIProviderFactory.ts +4 -4
- package/tsconfig.json +3 -3
- package/tsconfig.ref.json +1 -1
- package/__tests__/LDAIConfigMapper.test.ts +0 -159
- package/dist/LDAIClientImpl.d.ts +0 -23
- package/dist/LDAIClientImpl.d.ts.map +0 -1
- package/dist/LDAIClientImpl.js +0 -128
- package/dist/LDAIClientImpl.js.map +0 -1
- package/dist/LDAIConfigMapper.d.ts +0 -10
- package/dist/LDAIConfigMapper.d.ts.map +0 -1
- package/dist/LDAIConfigMapper.js +0 -55
- package/dist/LDAIConfigMapper.js.map +0 -1
- package/dist/LDAIConfigTrackerImpl.d.ts.map +0 -1
- package/dist/LDAIConfigTrackerImpl.js.map +0 -1
- package/dist/LDClientMin.d.ts.map +0 -1
- package/dist/api/LDAIClient.d.ts +0 -169
- package/dist/api/LDAIClient.d.ts.map +0 -1
- package/dist/api/agents/LDAIAgent.d.ts +0 -32
- package/dist/api/agents/LDAIAgent.d.ts.map +0 -1
- package/dist/api/agents/LDAIAgent.js.map +0 -1
- package/dist/api/agents/index.d.ts +0 -2
- package/dist/api/agents/index.d.ts.map +0 -1
- package/dist/api/agents/index.js.map +0 -1
- package/dist/api/chat/TrackedChat.d.ts.map +0 -1
- package/dist/api/chat/TrackedChat.js.map +0 -1
- package/dist/api/chat/index.d.ts.map +0 -1
- package/dist/api/chat/index.js.map +0 -1
- package/dist/api/chat/types.d.ts +0 -16
- package/dist/api/chat/types.d.ts.map +0 -1
- package/dist/api/config/LDAIConfig.d.ts +0 -92
- package/dist/api/config/LDAIConfig.d.ts.map +0 -1
- package/dist/api/config/LDAIConfig.js.map +0 -1
- package/dist/api/config/LDAIConfigTracker.d.ts.map +0 -1
- package/dist/api/config/LDAIConfigTracker.js.map +0 -1
- package/dist/api/config/VercelAISDK.d.ts +0 -19
- package/dist/api/config/VercelAISDK.d.ts.map +0 -1
- package/dist/api/config/VercelAISDK.js +0 -3
- package/dist/api/config/VercelAISDK.js.map +0 -1
- package/dist/api/config/index.d.ts +0 -4
- package/dist/api/config/index.d.ts.map +0 -1
- package/dist/api/config/index.js +0 -19
- package/dist/api/config/index.js.map +0 -1
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js.map +0 -1
- package/dist/api/metrics/BedrockTokenUsage.d.ts.map +0 -1
- package/dist/api/metrics/BedrockTokenUsage.js.map +0 -1
- package/dist/api/metrics/LDAIMetrics.d.ts.map +0 -1
- package/dist/api/metrics/LDAIMetrics.js.map +0 -1
- package/dist/api/metrics/LDFeedbackKind.d.ts.map +0 -1
- package/dist/api/metrics/LDFeedbackKind.js.map +0 -1
- package/dist/api/metrics/LDTokenUsage.d.ts.map +0 -1
- package/dist/api/metrics/LDTokenUsage.js.map +0 -1
- package/dist/api/metrics/OpenAiUsage.d.ts.map +0 -1
- package/dist/api/metrics/OpenAiUsage.js.map +0 -1
- package/dist/api/metrics/VercelAISDKTokenUsage.d.ts.map +0 -1
- package/dist/api/metrics/VercelAISDKTokenUsage.js.map +0 -1
- package/dist/api/metrics/index.d.ts.map +0 -1
- package/dist/api/metrics/index.js.map +0 -1
- package/dist/api/providers/AIProvider.d.ts.map +0 -1
- package/dist/api/providers/AIProvider.js +0 -31
- package/dist/api/providers/AIProvider.js.map +0 -1
- package/dist/api/providers/AIProviderFactory.d.ts.map +0 -1
- package/dist/api/providers/AIProviderFactory.js.map +0 -1
- package/dist/api/providers/index.d.ts.map +0 -1
- package/dist/api/providers/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/src/LDAIConfigMapper.ts +0 -65
- package/src/api/agents/LDAIAgent.ts +0 -36
- package/src/api/agents/index.ts +0 -1
- package/src/api/config/LDAIConfig.ts +0 -101
- package/src/api/config/VercelAISDK.ts +0 -21
- /package/dist/{LDClientMin.d.ts → src/LDClientMin.d.ts} +0 -0
- /package/dist/{LDClientMin.js → src/LDClientMin.js} +0 -0
- /package/dist/{api → src/api}/LDAIClient.js +0 -0
- /package/dist/{api → src/api}/chat/index.d.ts +0 -0
- /package/dist/{api → src/api}/chat/index.js +0 -0
- /package/dist/{api → src/api}/chat/types.js +0 -0
- /package/dist/{api → src/api}/config/LDAIConfigTracker.js +0 -0
- /package/dist/{api → src/api}/metrics/BedrockTokenUsage.d.ts +0 -0
- /package/dist/{api → src/api}/metrics/BedrockTokenUsage.js +0 -0
- /package/dist/{api → src/api}/metrics/LDAIMetrics.d.ts +0 -0
- /package/dist/{api → src/api}/metrics/LDAIMetrics.js +0 -0
- /package/dist/{api → src/api}/metrics/LDFeedbackKind.d.ts +0 -0
- /package/dist/{api → src/api}/metrics/LDFeedbackKind.js +0 -0
- /package/dist/{api → src/api}/metrics/LDTokenUsage.d.ts +0 -0
- /package/dist/{api → src/api}/metrics/LDTokenUsage.js +0 -0
- /package/dist/{api → src/api}/metrics/OpenAiUsage.d.ts +0 -0
- /package/dist/{api → src/api}/metrics/OpenAiUsage.js +0 -0
- /package/dist/{api → src/api}/metrics/VercelAISDKTokenUsage.d.ts +0 -0
- /package/dist/{api → src/api}/metrics/VercelAISDKTokenUsage.js +0 -0
- /package/dist/{api → src/api}/metrics/index.d.ts +0 -0
- /package/dist/{api → src/api}/metrics/index.js +0 -0
- /package/dist/{api → src/api}/providers/AIProviderFactory.js +0 -0
- /package/dist/{api → src/api}/providers/index.d.ts +0 -0
- /package/dist/{api → src/api}/providers/index.js +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>LDAIClient | @launchdarkly/server-sdk-ai - v0.
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>LDAIClient | @launchdarkly/server-sdk-ai - v0.14.0</title><meta name="description" content="Documentation for @launchdarkly/server-sdk-ai"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/search.js" id="tsd-search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
|
|
2
2
|
<div class="tsd-toolbar-contents container">
|
|
3
3
|
<div class="table-cell" id="tsd-search" data-base="..">
|
|
4
4
|
<div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<div id="tsd-toolbar-links"></div></div>
|
|
7
7
|
<ul class="results">
|
|
8
8
|
<li class="state loading">Preparing search index...</li>
|
|
9
|
-
<li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@launchdarkly/server-sdk-ai - v0.
|
|
9
|
+
<li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@launchdarkly/server-sdk-ai - v0.14.0</a></div>
|
|
10
10
|
<div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
|
|
11
11
|
<div class="container container-main">
|
|
12
12
|
<div class="col-content">
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<ul class="tsd-hierarchy">
|
|
25
25
|
<li><span class="target">LDAIClient</span></li></ul></section><aside class="tsd-sources">
|
|
26
26
|
<ul>
|
|
27
|
-
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/
|
|
27
|
+
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/a51dcdb/packages/sdk/server-ai/src/api/LDAIClient.ts#L19">sdk/server-ai/src/api/LDAIClient.ts:19</a></li></ul></aside>
|
|
28
28
|
<section class="tsd-panel-group tsd-index-group">
|
|
29
29
|
<section class="tsd-panel tsd-index-panel">
|
|
30
30
|
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
|
@@ -33,16 +33,44 @@
|
|
|
33
33
|
<section class="tsd-index-section">
|
|
34
34
|
<h3 class="tsd-index-heading">Methods</h3>
|
|
35
35
|
<div class="tsd-index-list"><a href="LDAIClient.html#agent" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-2048"><rect fill="var(--color-icon-background)" stroke="#FF4DB8" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="12"></rect><path d="M9.162 16V7.24H10.578L11.514 10.072C11.602 10.328 11.674 10.584 11.73 10.84C11.794 11.088 11.842 11.28 11.874 11.416C11.906 11.28 11.954 11.088 12.018 10.84C12.082 10.584 12.154 10.324 12.234 10.06L13.122 7.24H14.538V16H13.482V12.82C13.482 12.468 13.49 12.068 13.506 11.62C13.53 11.172 13.558 10.716 13.59 10.252C13.622 9.78 13.654 9.332 13.686 8.908C13.726 8.476 13.762 8.1 13.794 7.78L12.366 12.16H11.334L9.894 7.78C9.934 8.092 9.97 8.456 10.002 8.872C10.042 9.28 10.078 9.716 10.11 10.18C10.142 10.636 10.166 11.092 10.182 11.548C10.206 12.004 10.218 12.428 10.218 12.82V16H9.162Z" fill="var(--color-text)"></path></g></svg><span>agent</span></a>
|
|
36
|
+
<a href="LDAIClient.html#agentConfig" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>agent<wbr/>Config</span></a>
|
|
37
|
+
<a href="LDAIClient.html#agentConfigs" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>agent<wbr/>Configs</span></a>
|
|
36
38
|
<a href="LDAIClient.html#agents" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>agents</span></a>
|
|
39
|
+
<a href="LDAIClient.html#completionConfig" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>completion<wbr/>Config</span></a>
|
|
37
40
|
<a href="LDAIClient.html#config" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>config</span></a>
|
|
41
|
+
<a href="LDAIClient.html#createChat" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>create<wbr/>Chat</span></a>
|
|
42
|
+
<a href="LDAIClient.html#createJudge" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>create<wbr/>Judge</span></a>
|
|
38
43
|
<a href="LDAIClient.html#initChat" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>init<wbr/>Chat</span></a>
|
|
44
|
+
<a href="LDAIClient.html#judgeConfig" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>judge<wbr/>Config</span></a>
|
|
39
45
|
</div></section></div></details></section></section>
|
|
40
46
|
<section class="tsd-panel-group tsd-member-group">
|
|
41
47
|
<h2>Methods</h2>
|
|
42
48
|
<section class="tsd-panel tsd-member"><a id="agent" class="tsd-anchor"></a>
|
|
43
49
|
<h3 class="tsd-anchor-link"><span>agent</span><a href="#agent" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><g stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" id="icon-anchor"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></g></svg></a></h3>
|
|
44
50
|
<ul class="tsd-signatures">
|
|
45
|
-
<li class="tsd-signature tsd-anchor-link" id="agent.agent-1"><span class="tsd-kind-call-signature">agent</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">context</span>, <span class="tsd-kind-parameter">defaultValue</span>, <span class="tsd-kind-parameter">variables</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="
|
|
51
|
+
<li class="tsd-signature tsd-anchor-link" id="agent.agent-1"><span class="tsd-kind-call-signature">agent</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">context</span>, <span class="tsd-kind-parameter">defaultValue</span>, <span class="tsd-kind-parameter">variables</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="LDAIAgentConfig.html" class="tsd-signature-type tsd-kind-interface">LDAIAgentConfig</a><span class="tsd-signature-symbol">></span><a href="#agent.agent-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
52
|
+
<li class="tsd-description">
|
|
53
|
+
<div class="tsd-parameters">
|
|
54
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
55
|
+
<ul class="tsd-parameter-list">
|
|
56
|
+
<li>
|
|
57
|
+
<h5><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></h5></li>
|
|
58
|
+
<li>
|
|
59
|
+
<h5><span class="tsd-kind-parameter">context</span>: <span class="tsd-signature-type ">LDContext</span></h5></li>
|
|
60
|
+
<li>
|
|
61
|
+
<h5><span class="tsd-kind-parameter">defaultValue</span>: <a href="LDAIAgentConfigDefault.html" class="tsd-signature-type tsd-kind-interface">LDAIAgentConfigDefault</a></h5></li>
|
|
62
|
+
<li>
|
|
63
|
+
<h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">variables</span>: <span class="tsd-signature-type ">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></h5><code class="tsd-tag ts-flagOptional">Optional</code> </li></ul></div>
|
|
64
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="LDAIAgentConfig.html" class="tsd-signature-type tsd-kind-interface">LDAIAgentConfig</a><span class="tsd-signature-symbol">></span></h4>
|
|
65
|
+
<div class="tsd-comment tsd-typography">
|
|
66
|
+
<h4>Deprecated</h4><p>Use <code>agentConfig</code> instead. This method will be removed in a future version.</p>
|
|
67
|
+
</div><aside class="tsd-sources">
|
|
68
|
+
<ul>
|
|
69
|
+
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/a51dcdb/packages/sdk/server-ai/src/api/LDAIClient.ts#L133">sdk/server-ai/src/api/LDAIClient.ts:133</a></li></ul></aside></li></ul></section>
|
|
70
|
+
<section class="tsd-panel tsd-member"><a id="agentConfig" class="tsd-anchor"></a>
|
|
71
|
+
<h3 class="tsd-anchor-link"><span>agent<wbr/>Config</span><a href="#agentConfig" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
72
|
+
<ul class="tsd-signatures">
|
|
73
|
+
<li class="tsd-signature tsd-anchor-link" id="agentConfig.agentConfig-1"><span class="tsd-kind-call-signature">agent<wbr/>Config</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">context</span>, <span class="tsd-kind-parameter">defaultValue</span>, <span class="tsd-kind-parameter">variables</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="LDAIAgentConfig.html" class="tsd-signature-type tsd-kind-interface">LDAIAgentConfig</a><span class="tsd-signature-symbol">></span><a href="#agentConfig.agentConfig-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
46
74
|
<li class="tsd-description">
|
|
47
75
|
<div class="tsd-comment tsd-typography"><p>Retrieves and processes a single AI Config agent based on the provided key, LaunchDarkly context,
|
|
48
76
|
and variables. This includes the model configuration and the customized instructions.</p>
|
|
@@ -61,7 +89,7 @@ current environment, user, or session. This context may influence how the config
|
|
|
61
89
|
processed or personalized.</p>
|
|
62
90
|
</div></li>
|
|
63
91
|
<li>
|
|
64
|
-
<h5><span class="tsd-kind-parameter">defaultValue</span>: <a href="
|
|
92
|
+
<h5><span class="tsd-kind-parameter">defaultValue</span>: <a href="LDAIAgentConfigDefault.html" class="tsd-signature-type tsd-kind-interface">LDAIAgentConfigDefault</a></h5>
|
|
65
93
|
<div class="tsd-comment tsd-typography"><p>A fallback value containing model configuration and instructions.</p>
|
|
66
94
|
</div></li>
|
|
67
95
|
<li>
|
|
@@ -70,20 +98,20 @@ processed or personalized.</p>
|
|
|
70
98
|
the instructions. The keys correspond to placeholders within the template, and the values
|
|
71
99
|
are the corresponding replacements.</p>
|
|
72
100
|
</div><code class="tsd-tag ts-flagOptional">Optional</code> </li></ul></div>
|
|
73
|
-
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="
|
|
101
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="LDAIAgentConfig.html" class="tsd-signature-type tsd-kind-interface">LDAIAgentConfig</a><span class="tsd-signature-symbol">></span></h4><p>An AI agent with customized <code>instructions</code> and a <code>tracker</code>. If the configuration
|
|
74
102
|
cannot be accessed from LaunchDarkly, then the return value will include information from the
|
|
75
103
|
<code>defaultValue</code>. The returned <code>tracker</code> can be used to track AI operation metrics (latency, token usage, etc.).</p>
|
|
76
104
|
|
|
77
105
|
<div class="tsd-comment tsd-typography">
|
|
78
|
-
<h4>Example</h4><pre><code><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">key</span><span class="hl-1"> = </span><span class="hl-3">"research_agent"</span><span class="hl-1">;</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">context</span><span class="hl-1"> = {...};</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">variables</span><span class="hl-1"> = { </span><span class="hl-4">topic:</span><span class="hl-1"> </span><span class="hl-3">'climate change'</span><span class="hl-1"> };</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">
|
|
106
|
+
<h4>Example</h4><pre><code><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">key</span><span class="hl-1"> = </span><span class="hl-3">"research_agent"</span><span class="hl-1">;</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">context</span><span class="hl-1"> = {...};</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">variables</span><span class="hl-1"> = { </span><span class="hl-4">topic:</span><span class="hl-1"> </span><span class="hl-3">'climate change'</span><span class="hl-1"> };</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">agentConfig</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">client</span><span class="hl-1">.</span><span class="hl-6">agentConfig</span><span class="hl-1">(</span><span class="hl-4">key</span><span class="hl-1">, </span><span class="hl-4">context</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">enabled:</span><span class="hl-1"> </span><span class="hl-0">true</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">model:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">'gpt-4'</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">provider:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">'openai'</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">instructions:</span><span class="hl-1"> </span><span class="hl-3">'You are a research assistant.'</span><span class="hl-1">,</span><br/><span class="hl-1">}, </span><span class="hl-4">variables</span><span class="hl-1">);</span><br/><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">researchResult</span><span class="hl-1"> = </span><span class="hl-4">agentConfig</span><span class="hl-1">.</span><span class="hl-4">instructions</span><span class="hl-1">; </span><span class="hl-7">// Interpolated instructions</span><br/><span class="hl-4">agentConfig</span><span class="hl-1">.</span><span class="hl-4">tracker</span><span class="hl-1">.</span><span class="hl-6">trackSuccess</span><span class="hl-1">();</span>
|
|
79
107
|
</code><button>Copy</button></pre>
|
|
80
108
|
</div><aside class="tsd-sources">
|
|
81
109
|
<ul>
|
|
82
|
-
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/
|
|
83
|
-
<section class="tsd-panel tsd-member"><a id="
|
|
84
|
-
<h3 class="tsd-anchor-link"><span>
|
|
110
|
+
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/a51dcdb/packages/sdk/server-ai/src/api/LDAIClient.ts#L123">sdk/server-ai/src/api/LDAIClient.ts:123</a></li></ul></aside></li></ul></section>
|
|
111
|
+
<section class="tsd-panel tsd-member"><a id="agentConfigs" class="tsd-anchor"></a>
|
|
112
|
+
<h3 class="tsd-anchor-link"><span>agent<wbr/>Configs</span><a href="#agentConfigs" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
85
113
|
<ul class="tsd-signatures">
|
|
86
|
-
<li class="tsd-signature tsd-anchor-link" id="
|
|
114
|
+
<li class="tsd-signature tsd-anchor-link" id="agentConfigs.agentConfigs-1"><span class="tsd-kind-call-signature">agent<wbr/>Configs</span><span class="tsd-signature-symbol"><</span>const <span class="tsd-signature-type tsd-kind-type-parameter">T</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">agentConfigs</span>, <span class="tsd-kind-parameter">context</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type ">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-kind-type-parameter">T</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">"key"</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">, </span><a href="LDAIAgentConfig.html" class="tsd-signature-type tsd-kind-interface">LDAIAgentConfig</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#agentConfigs.agentConfigs-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
87
115
|
<li class="tsd-description">
|
|
88
116
|
<div class="tsd-comment tsd-typography"><p>Retrieves and processes multiple AI Config agents based on the provided agent configurations
|
|
89
117
|
and LaunchDarkly context. This includes the model configuration and the customized instructions.</p>
|
|
@@ -92,7 +120,7 @@ and LaunchDarkly context. This includes the model configuration and the customiz
|
|
|
92
120
|
<h4>Type Parameters</h4>
|
|
93
121
|
<ul class="tsd-type-parameter-list">
|
|
94
122
|
<li>
|
|
95
|
-
<h4>const <span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-symbol"> extends </span><span class="tsd-signature-symbol">readonly </span><a href="
|
|
123
|
+
<h4>const <span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-symbol"> extends </span><span class="tsd-signature-symbol">readonly </span><a href="LDAIAgentRequestConfig.html" class="tsd-signature-type tsd-kind-interface">LDAIAgentRequestConfig</a><span class="tsd-signature-symbol">[]</span></h4></li></ul></section>
|
|
96
124
|
<div class="tsd-parameters">
|
|
97
125
|
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
98
126
|
<ul class="tsd-parameter-list">
|
|
@@ -107,23 +135,46 @@ and variables for instructions interpolation.</p>
|
|
|
107
135
|
current environment, user, or session. This context may influence how the configuration is
|
|
108
136
|
processed or personalized.</p>
|
|
109
137
|
</div></li></ul></div>
|
|
110
|
-
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type ">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-kind-type-parameter">T</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">"key"</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">, </span><a href="
|
|
138
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type ">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-kind-type-parameter">T</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">"key"</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">, </span><a href="LDAIAgentConfig.html" class="tsd-signature-type tsd-kind-interface">LDAIAgentConfig</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4><p>A map of agent keys to their respective AI agents with customized <code>instructions</code> and <code>tracker</code>.
|
|
111
139
|
If a configuration cannot be accessed from LaunchDarkly, then the return value will include information
|
|
112
140
|
from the respective <code>defaultValue</code>. The returned <code>tracker</code> can be used to track AI operation metrics
|
|
113
141
|
(latency, token usage, etc.).</p>
|
|
114
142
|
|
|
115
143
|
<div class="tsd-comment tsd-typography">
|
|
116
|
-
<h4>Example</h4><pre><code><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">
|
|
144
|
+
<h4>Example</h4><pre><code><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">agentConfigsList</span><span class="hl-1"> = [</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">key:</span><span class="hl-1"> </span><span class="hl-3">'research_agent'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">defaultValue:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">enabled:</span><span class="hl-1"> </span><span class="hl-0">true</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">model:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">'gpt-4'</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">provider:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">'openai'</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">instructions:</span><span class="hl-1"> </span><span class="hl-3">'You are a research assistant.'</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">variables:</span><span class="hl-1"> { </span><span class="hl-4">topic:</span><span class="hl-1"> </span><span class="hl-3">'climate change'</span><span class="hl-1"> }</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">key:</span><span class="hl-1"> </span><span class="hl-3">'writing_agent'</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">defaultValue:</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">enabled:</span><span class="hl-1"> </span><span class="hl-0">true</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">model:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">'gpt-4'</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">provider:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">'openai'</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">instructions:</span><span class="hl-1"> </span><span class="hl-3">'You are a writing assistant.'</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">variables:</span><span class="hl-1"> { </span><span class="hl-4">style:</span><span class="hl-1"> </span><span class="hl-3">'academic'</span><span class="hl-1"> }</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">] </span><span class="hl-5">as</span><span class="hl-1"> </span><span class="hl-0">const</span><span class="hl-1">;</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">context</span><span class="hl-1"> = {...};</span><br/><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">configs</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">client</span><span class="hl-1">.</span><span class="hl-6">agentConfigs</span><span class="hl-1">(</span><span class="hl-4">agentConfigsList</span><span class="hl-1">, </span><span class="hl-4">context</span><span class="hl-1">);</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">researchResult</span><span class="hl-1"> = </span><span class="hl-4">configs</span><span class="hl-1">[</span><span class="hl-3">"research_agent"</span><span class="hl-1">].</span><span class="hl-4">instructions</span><span class="hl-1">; </span><span class="hl-7">// Interpolated instructions</span><br/><span class="hl-4">configs</span><span class="hl-1">[</span><span class="hl-3">"research_agent"</span><span class="hl-1">].</span><span class="hl-4">tracker</span><span class="hl-1">.</span><span class="hl-6">trackSuccess</span><span class="hl-1">();</span>
|
|
117
145
|
</code><button>Copy</button></pre>
|
|
118
146
|
</div><aside class="tsd-sources">
|
|
119
147
|
<ul>
|
|
120
|
-
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/
|
|
121
|
-
<section class="tsd-panel tsd-member"><a id="
|
|
122
|
-
<h3 class="tsd-anchor-link"><span>
|
|
148
|
+
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/a51dcdb/packages/sdk/server-ai/src/api/LDAIClient.ts#L220">sdk/server-ai/src/api/LDAIClient.ts:220</a></li></ul></aside></li></ul></section>
|
|
149
|
+
<section class="tsd-panel tsd-member"><a id="agents" class="tsd-anchor"></a>
|
|
150
|
+
<h3 class="tsd-anchor-link"><span>agents</span><a href="#agents" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
151
|
+
<ul class="tsd-signatures">
|
|
152
|
+
<li class="tsd-signature tsd-anchor-link" id="agents.agents-1"><span class="tsd-kind-call-signature">agents</span><span class="tsd-signature-symbol"><</span>const <span class="tsd-signature-type tsd-kind-type-parameter">T</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">agentConfigs</span>, <span class="tsd-kind-parameter">context</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type ">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-kind-type-parameter">T</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">"key"</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">, </span><a href="LDAIAgentConfig.html" class="tsd-signature-type tsd-kind-interface">LDAIAgentConfig</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span><a href="#agents.agents-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
153
|
+
<li class="tsd-description">
|
|
154
|
+
<section class="tsd-panel">
|
|
155
|
+
<h4>Type Parameters</h4>
|
|
156
|
+
<ul class="tsd-type-parameter-list">
|
|
157
|
+
<li>
|
|
158
|
+
<h4>const <span class="tsd-kind-type-parameter">T</span><span class="tsd-signature-symbol"> extends </span><span class="tsd-signature-symbol">readonly </span><a href="LDAIAgentRequestConfig.html" class="tsd-signature-type tsd-kind-interface">LDAIAgentRequestConfig</a><span class="tsd-signature-symbol">[]</span></h4></li></ul></section>
|
|
159
|
+
<div class="tsd-parameters">
|
|
160
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
161
|
+
<ul class="tsd-parameter-list">
|
|
162
|
+
<li>
|
|
163
|
+
<h5><span class="tsd-kind-parameter">agentConfigs</span>: <span class="tsd-signature-type tsd-kind-type-parameter">T</span></h5></li>
|
|
164
|
+
<li>
|
|
165
|
+
<h5><span class="tsd-kind-parameter">context</span>: <span class="tsd-signature-type ">LDContext</span></h5></li></ul></div>
|
|
166
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type ">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type tsd-kind-type-parameter">T</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">"key"</span><span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">, </span><a href="LDAIAgentConfig.html" class="tsd-signature-type tsd-kind-interface">LDAIAgentConfig</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">></span></h4>
|
|
167
|
+
<div class="tsd-comment tsd-typography">
|
|
168
|
+
<h4>Deprecated</h4><p>Use <code>agentConfigs</code> instead. This method will be removed in a future version.</p>
|
|
169
|
+
</div><aside class="tsd-sources">
|
|
170
|
+
<ul>
|
|
171
|
+
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/a51dcdb/packages/sdk/server-ai/src/api/LDAIClient.ts#L228">sdk/server-ai/src/api/LDAIClient.ts:228</a></li></ul></aside></li></ul></section>
|
|
172
|
+
<section class="tsd-panel tsd-member"><a id="completionConfig" class="tsd-anchor"></a>
|
|
173
|
+
<h3 class="tsd-anchor-link"><span>completion<wbr/>Config</span><a href="#completionConfig" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
123
174
|
<ul class="tsd-signatures">
|
|
124
|
-
<li class="tsd-signature tsd-anchor-link" id="
|
|
175
|
+
<li class="tsd-signature tsd-anchor-link" id="completionConfig.completionConfig-1"><span class="tsd-kind-call-signature">completion<wbr/>Config</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">context</span>, <span class="tsd-kind-parameter">defaultValue</span>, <span class="tsd-kind-parameter">variables</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="LDAICompletionConfig.html" class="tsd-signature-type tsd-kind-interface">LDAICompletionConfig</a><span class="tsd-signature-symbol">></span><a href="#completionConfig.completionConfig-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
125
176
|
<li class="tsd-description">
|
|
126
|
-
<div class="tsd-comment tsd-typography"><p>Retrieves and processes
|
|
177
|
+
<div class="tsd-comment tsd-typography"><p>Retrieves and processes a completion AI Config based on the provided key, LaunchDarkly context,
|
|
127
178
|
and variables. This includes the model configuration and the customized messages.</p>
|
|
128
179
|
</div>
|
|
129
180
|
<div class="tsd-parameters">
|
|
@@ -140,7 +191,7 @@ current environment, user, or session. This context may influence how the config
|
|
|
140
191
|
processed or personalized.</p>
|
|
141
192
|
</div></li>
|
|
142
193
|
<li>
|
|
143
|
-
<h5><span class="tsd-kind-parameter">defaultValue</span>: <a href="
|
|
194
|
+
<h5><span class="tsd-kind-parameter">defaultValue</span>: <a href="LDAICompletionConfigDefault.html" class="tsd-signature-type tsd-kind-interface">LDAICompletionConfigDefault</a></h5>
|
|
144
195
|
<div class="tsd-comment tsd-typography"><p>A fallback value containing model configuration and messages. This will
|
|
145
196
|
be used if the configuration is not available from LaunchDarkly.</p>
|
|
146
197
|
</div></li>
|
|
@@ -150,22 +201,44 @@ be used if the configuration is not available from LaunchDarkly.</p>
|
|
|
150
201
|
the message content. The keys correspond to placeholders within the template, and the values
|
|
151
202
|
are the corresponding replacements.</p>
|
|
152
203
|
</div><code class="tsd-tag ts-flagOptional">Optional</code> </li></ul></div>
|
|
153
|
-
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="
|
|
204
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="LDAICompletionConfig.html" class="tsd-signature-type tsd-kind-interface">LDAICompletionConfig</a><span class="tsd-signature-symbol">></span></h4><p>The AI <code>config</code>, customized <code>messages</code>, and a <code>tracker</code>. If the configuration cannot be accessed from
|
|
154
205
|
LaunchDarkly, then the return value will include information from the <code>defaultValue</code>. The returned <code>tracker</code> can
|
|
155
206
|
be used to track AI operation metrics (latency, token usage, etc.).</p>
|
|
156
207
|
|
|
157
208
|
<div class="tsd-comment tsd-typography">
|
|
158
|
-
<h4>Example</h4><pre><code><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">key</span><span class="hl-1"> = </span><span class="hl-3">"welcome_prompt"</span><span class="hl-1">;</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">context</span><span class="hl-1"> = {...};</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">variables</span><span class="hl-1"> = {</span><span class="hl-4">username:</span><span class="hl-1"> </span><span class="hl-3">'john'</span><span class="hl-1">};</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">defaultValue</span><span class="hl-1"> = {</span><br/><span class="hl-1"> </span><span class="hl-4">enabled:</span><span class="hl-1"> </span><span class="hl-0">false</span><span class="hl-1">,</span><br/><span class="hl-1">};</span><br/><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">result</span><span class="hl-1"> = </span><span class="hl-6">
|
|
209
|
+
<h4>Example</h4><pre><code><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">key</span><span class="hl-1"> = </span><span class="hl-3">"welcome_prompt"</span><span class="hl-1">;</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">context</span><span class="hl-1"> = {...};</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">variables</span><span class="hl-1"> = {</span><span class="hl-4">username:</span><span class="hl-1"> </span><span class="hl-3">'john'</span><span class="hl-1">};</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">defaultValue</span><span class="hl-1"> = {</span><br/><span class="hl-1"> </span><span class="hl-4">enabled:</span><span class="hl-1"> </span><span class="hl-0">false</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">model:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">'gpt-4'</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">provider:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">'openai'</span><span class="hl-1"> },</span><br/><span class="hl-1">};</span><br/><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">result</span><span class="hl-1"> = </span><span class="hl-6">completionConfig</span><span class="hl-1">(</span><span class="hl-4">key</span><span class="hl-1">, </span><span class="hl-4">context</span><span class="hl-1">, </span><span class="hl-4">defaultValue</span><span class="hl-1">, </span><span class="hl-4">variables</span><span class="hl-1">);</span><br/><span class="hl-7">// Output:</span><br/><span class="hl-1">{</span><br/><span class="hl-1"> </span><span class="hl-8">enabled</span><span class="hl-1">: </span><span class="hl-0">true</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-8">config</span><span class="hl-1">: {</span><br/><span class="hl-1"> </span><span class="hl-8">modelId</span><span class="hl-1">: </span><span class="hl-3">"gpt-4o"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-8">temperature</span><span class="hl-1">: </span><span class="hl-9">0.2</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-8">maxTokens</span><span class="hl-1">: </span><span class="hl-9">4096</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-8">userDefinedKey</span><span class="hl-1">: </span><span class="hl-3">"myValue"</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-8">messages</span><span class="hl-1">: [</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">role:</span><span class="hl-1"> </span><span class="hl-3">"system"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">content:</span><span class="hl-1"> </span><span class="hl-3">"You are an amazing GPT."</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">role:</span><span class="hl-1"> </span><span class="hl-3">"user"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">content:</span><span class="hl-1"> </span><span class="hl-3">"Explain how you're an amazing GPT."</span><br/><span class="hl-1"> }</span><br/><span class="hl-1"> ],</span><br/><span class="hl-1"> </span><span class="hl-8">tracker</span><span class="hl-1">: ...</span><br/><span class="hl-1">}</span>
|
|
159
210
|
</code><button>Copy</button></pre>
|
|
160
211
|
</div><aside class="tsd-sources">
|
|
161
212
|
<ul>
|
|
162
|
-
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/
|
|
163
|
-
<section class="tsd-panel tsd-member"><a id="
|
|
164
|
-
<h3 class="tsd-anchor-link"><span>
|
|
213
|
+
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/a51dcdb/packages/sdk/server-ai/src/api/LDAIClient.ts#L73">sdk/server-ai/src/api/LDAIClient.ts:73</a></li></ul></aside></li></ul></section>
|
|
214
|
+
<section class="tsd-panel tsd-member"><a id="config" class="tsd-anchor"></a>
|
|
215
|
+
<h3 class="tsd-anchor-link"><span>config</span><a href="#config" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
165
216
|
<ul class="tsd-signatures">
|
|
166
|
-
<li class="tsd-signature tsd-anchor-link" id="
|
|
217
|
+
<li class="tsd-signature tsd-anchor-link" id="config.config-1"><span class="tsd-kind-call-signature">config</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">context</span>, <span class="tsd-kind-parameter">defaultValue</span>, <span class="tsd-kind-parameter">variables</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="LDAICompletionConfig.html" class="tsd-signature-type tsd-kind-interface">LDAICompletionConfig</a><span class="tsd-signature-symbol">></span><a href="#config.config-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
218
|
+
<li class="tsd-description">
|
|
219
|
+
<div class="tsd-parameters">
|
|
220
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
221
|
+
<ul class="tsd-parameter-list">
|
|
222
|
+
<li>
|
|
223
|
+
<h5><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></h5></li>
|
|
224
|
+
<li>
|
|
225
|
+
<h5><span class="tsd-kind-parameter">context</span>: <span class="tsd-signature-type ">LDContext</span></h5></li>
|
|
226
|
+
<li>
|
|
227
|
+
<h5><span class="tsd-kind-parameter">defaultValue</span>: <a href="LDAICompletionConfigDefault.html" class="tsd-signature-type tsd-kind-interface">LDAICompletionConfigDefault</a></h5></li>
|
|
228
|
+
<li>
|
|
229
|
+
<h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">variables</span>: <span class="tsd-signature-type ">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></h5><code class="tsd-tag ts-flagOptional">Optional</code> </li></ul></div>
|
|
230
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="LDAICompletionConfig.html" class="tsd-signature-type tsd-kind-interface">LDAICompletionConfig</a><span class="tsd-signature-symbol">></span></h4>
|
|
231
|
+
<div class="tsd-comment tsd-typography">
|
|
232
|
+
<h4>Deprecated</h4><p>Use <code>completionConfig</code> instead. This method will be removed in a future version.</p>
|
|
233
|
+
</div><aside class="tsd-sources">
|
|
234
|
+
<ul>
|
|
235
|
+
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/a51dcdb/packages/sdk/server-ai/src/api/LDAIClient.ts#L83">sdk/server-ai/src/api/LDAIClient.ts:83</a></li></ul></aside></li></ul></section>
|
|
236
|
+
<section class="tsd-panel tsd-member"><a id="createChat" class="tsd-anchor"></a>
|
|
237
|
+
<h3 class="tsd-anchor-link"><span>create<wbr/>Chat</span><a href="#createChat" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
238
|
+
<ul class="tsd-signatures">
|
|
239
|
+
<li class="tsd-signature tsd-anchor-link" id="createChat.createChat-1"><span class="tsd-kind-call-signature">create<wbr/>Chat</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">context</span>, <span class="tsd-kind-parameter">defaultValue</span>, <span class="tsd-kind-parameter">variables</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">defaultAiProvider</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../classes/TrackedChat.html" class="tsd-signature-type tsd-kind-class">TrackedChat</a><span class="tsd-signature-symbol">></span><a href="#createChat.createChat-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
167
240
|
<li class="tsd-description">
|
|
168
|
-
<div class="tsd-comment tsd-typography"><p>
|
|
241
|
+
<div class="tsd-comment tsd-typography"><p>Returns a TrackedChat instance for chat interactions.
|
|
169
242
|
This method serves as the primary entry point for creating TrackedChat instances from configuration.</p>
|
|
170
243
|
</div>
|
|
171
244
|
<div class="tsd-parameters">
|
|
@@ -180,23 +253,128 @@ This method serves as the primary entry point for creating TrackedChat instances
|
|
|
180
253
|
<div class="tsd-comment tsd-typography"><p>The standard LDContext used when evaluating flags.</p>
|
|
181
254
|
</div></li>
|
|
182
255
|
<li>
|
|
183
|
-
<h5><span class="tsd-kind-parameter">defaultValue</span>: <a href="
|
|
256
|
+
<h5><span class="tsd-kind-parameter">defaultValue</span>: <a href="LDAICompletionConfigDefault.html" class="tsd-signature-type tsd-kind-interface">LDAICompletionConfigDefault</a></h5>
|
|
184
257
|
<div class="tsd-comment tsd-typography"><p>A default value representing a standard AI chat config result.</p>
|
|
185
258
|
</div></li>
|
|
186
259
|
<li>
|
|
187
260
|
<h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">variables</span>: <span class="tsd-signature-type ">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></h5>
|
|
188
|
-
<div class="tsd-comment tsd-typography"><p>Dictionary of values for instruction interpolation
|
|
261
|
+
<div class="tsd-comment tsd-typography"><p>Dictionary of values for instruction interpolation.
|
|
262
|
+
The variables will also be used for judge evaluation. For the judge only, the variables
|
|
263
|
+
<code>message_history</code> and <code>response_to_evaluate</code> are reserved and will be ignored.</p>
|
|
189
264
|
</div><code class="tsd-tag ts-flagOptional">Optional</code> </li>
|
|
190
265
|
<li>
|
|
191
|
-
<h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">defaultAiProvider</span>: <span class="tsd-signature-type">"openai"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"langchain"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"vercel"</span></h5
|
|
266
|
+
<h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">defaultAiProvider</span>: <span class="tsd-signature-type">"openai"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"langchain"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"vercel"</span></h5>
|
|
267
|
+
<div class="tsd-comment tsd-typography"><p>Optional default AI provider to use.</p>
|
|
268
|
+
</div><code class="tsd-tag ts-flagOptional">Optional</code> </li></ul></div>
|
|
192
269
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../classes/TrackedChat.html" class="tsd-signature-type tsd-kind-class">TrackedChat</a><span class="tsd-signature-symbol">></span></h4><p>A promise that resolves to the TrackedChat instance, or null if the configuration is disabled.</p>
|
|
193
270
|
|
|
194
271
|
<div class="tsd-comment tsd-typography">
|
|
195
|
-
<h4>Example</h4><pre><code><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">key</span><span class="hl-1"> = </span><span class="hl-3">"customer_support_chat"</span><span class="hl-1">;</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">context</span><span class="hl-1"> = {...};</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">defaultValue</span><span class="hl-1"> = {</span><br/><span class="hl-1"> </span><span class="hl-4">
|
|
272
|
+
<h4>Example</h4><pre><code><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">key</span><span class="hl-1"> = </span><span class="hl-3">"customer_support_chat"</span><span class="hl-1">;</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">context</span><span class="hl-1"> = {...};</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">defaultValue</span><span class="hl-1"> = {</span><br/><span class="hl-1"> </span><span class="hl-4">enabled:</span><span class="hl-1"> </span><span class="hl-0">false</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">model:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">"gpt-4"</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">provider:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">"openai"</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">messages:</span><span class="hl-1"> [</span><br/><span class="hl-1"> { </span><span class="hl-4">role:</span><span class="hl-1"> </span><span class="hl-3">"system"</span><span class="hl-1">, </span><span class="hl-4">content:</span><span class="hl-1"> </span><span class="hl-3">"You are a helpful customer support agent."</span><span class="hl-1"> }</span><br/><span class="hl-1"> ]</span><br/><span class="hl-1">};</span><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">variables</span><span class="hl-1"> = { </span><span class="hl-4">customerName:</span><span class="hl-1"> </span><span class="hl-3">'John'</span><span class="hl-1"> };</span><br/><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">chat</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">client</span><span class="hl-1">.</span><span class="hl-6">createChat</span><span class="hl-1">(</span><span class="hl-4">key</span><span class="hl-1">, </span><span class="hl-4">context</span><span class="hl-1">, </span><span class="hl-4">defaultValue</span><span class="hl-1">, </span><span class="hl-4">variables</span><span class="hl-1">);</span><br/><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">chat</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">response</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">chat</span><span class="hl-1">.</span><span class="hl-6">invoke</span><span class="hl-1">(</span><span class="hl-3">"I need help with my order"</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-6">log</span><span class="hl-1">(</span><span class="hl-4">response</span><span class="hl-1">.</span><span class="hl-4">message</span><span class="hl-1">.</span><span class="hl-4">content</span><span class="hl-1">);</span><br/><span class="hl-1">}</span>
|
|
273
|
+
</code><button>Copy</button></pre>
|
|
274
|
+
</div><aside class="tsd-sources">
|
|
275
|
+
<ul>
|
|
276
|
+
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/a51dcdb/packages/sdk/server-ai/src/api/LDAIClient.ts#L267">sdk/server-ai/src/api/LDAIClient.ts:267</a></li></ul></aside></li></ul></section>
|
|
277
|
+
<section class="tsd-panel tsd-member"><a id="createJudge" class="tsd-anchor"></a>
|
|
278
|
+
<h3 class="tsd-anchor-link"><span>create<wbr/>Judge</span><a href="#createJudge" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
279
|
+
<ul class="tsd-signatures">
|
|
280
|
+
<li class="tsd-signature tsd-anchor-link" id="createJudge.createJudge-1"><span class="tsd-kind-call-signature">create<wbr/>Judge</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">context</span>, <span class="tsd-kind-parameter">defaultValue</span>, <span class="tsd-kind-parameter">variables</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">defaultAiProvider</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../classes/Judge.html" class="tsd-signature-type tsd-kind-class">Judge</a><span class="tsd-signature-symbol">></span><a href="#createJudge.createJudge-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
281
|
+
<li class="tsd-description">
|
|
282
|
+
<div class="tsd-comment tsd-typography"><p>Creates and returns a new Judge instance for AI evaluation.</p>
|
|
283
|
+
</div>
|
|
284
|
+
<div class="tsd-parameters">
|
|
285
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
286
|
+
<ul class="tsd-parameter-list">
|
|
287
|
+
<li>
|
|
288
|
+
<h5><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></h5>
|
|
289
|
+
<div class="tsd-comment tsd-typography"><p>The key identifying the AI judge configuration to use</p>
|
|
290
|
+
</div></li>
|
|
291
|
+
<li>
|
|
292
|
+
<h5><span class="tsd-kind-parameter">context</span>: <span class="tsd-signature-type ">LDContext</span></h5>
|
|
293
|
+
<div class="tsd-comment tsd-typography"><p>Standard LDContext used when evaluating flags</p>
|
|
294
|
+
</div></li>
|
|
295
|
+
<li>
|
|
296
|
+
<h5><span class="tsd-kind-parameter">defaultValue</span>: <a href="LDAIJudgeConfigDefault.html" class="tsd-signature-type tsd-kind-interface">LDAIJudgeConfigDefault</a></h5>
|
|
297
|
+
<div class="tsd-comment tsd-typography"><p>A default value representing a standard AI config result</p>
|
|
298
|
+
</div></li>
|
|
299
|
+
<li>
|
|
300
|
+
<h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">variables</span>: <span class="tsd-signature-type ">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></h5>
|
|
301
|
+
<div class="tsd-comment tsd-typography"><p>Dictionary of values for instruction interpolation.
|
|
302
|
+
The variables <code>message_history</code> and <code>response_to_evaluate</code> are reserved for the judge and will be ignored.</p>
|
|
303
|
+
</div><code class="tsd-tag ts-flagOptional">Optional</code> </li>
|
|
304
|
+
<li>
|
|
305
|
+
<h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">defaultAiProvider</span>: <span class="tsd-signature-type">"openai"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"langchain"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"vercel"</span></h5>
|
|
306
|
+
<div class="tsd-comment tsd-typography"><p>Optional default AI provider to use.</p>
|
|
307
|
+
</div><code class="tsd-tag ts-flagOptional">Optional</code> </li></ul></div>
|
|
308
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../classes/Judge.html" class="tsd-signature-type tsd-kind-class">Judge</a><span class="tsd-signature-symbol">></span></h4><p>Promise that resolves to a Judge instance or undefined if disabled/unsupported</p>
|
|
309
|
+
|
|
310
|
+
<div class="tsd-comment tsd-typography">
|
|
311
|
+
<h4>Example</h4><pre><code><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">judge</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">client</span><span class="hl-1">.</span><span class="hl-6">createJudge</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-3">"relevance-judge"</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">context</span><span class="hl-1">,</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">enabled:</span><span class="hl-1"> </span><span class="hl-0">true</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">model:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">"gpt-4"</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">provider:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">"openai"</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">evaluationMetricKeys:</span><span class="hl-1"> [</span><span class="hl-3">'$ld:ai:judge:relevance'</span><span class="hl-1">],</span><br/><span class="hl-1"> </span><span class="hl-4">messages:</span><span class="hl-1"> [{ </span><span class="hl-4">role:</span><span class="hl-1"> </span><span class="hl-3">'system'</span><span class="hl-1">, </span><span class="hl-4">content:</span><span class="hl-1"> </span><span class="hl-3">'You are a relevance judge.'</span><span class="hl-1"> }]</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> { </span><span class="hl-4">metric:</span><span class="hl-1"> </span><span class="hl-3">"relevance"</span><span class="hl-1"> }</span><br/><span class="hl-1">);</span><br/><br/><span class="hl-5">if</span><span class="hl-1"> (</span><span class="hl-4">judge</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">result</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">judge</span><span class="hl-1">.</span><span class="hl-6">evaluate</span><span class="hl-1">(</span><span class="hl-3">"User question"</span><span class="hl-1">, </span><span class="hl-3">"AI response"</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-6">log</span><span class="hl-1">(</span><span class="hl-3">'Relevance score:'</span><span class="hl-1">, </span><span class="hl-4">result</span><span class="hl-1">.</span><span class="hl-4">evals</span><span class="hl-1">.</span><span class="hl-4">relevance</span><span class="hl-1">?.</span><span class="hl-4">score</span><span class="hl-1">);</span><br/><span class="hl-1">}</span>
|
|
312
|
+
</code><button>Copy</button></pre>
|
|
313
|
+
</div><aside class="tsd-sources">
|
|
314
|
+
<ul>
|
|
315
|
+
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/a51dcdb/packages/sdk/server-ai/src/api/LDAIClient.ts#L318">sdk/server-ai/src/api/LDAIClient.ts:318</a></li></ul></aside></li></ul></section>
|
|
316
|
+
<section class="tsd-panel tsd-member"><a id="initChat" class="tsd-anchor"></a>
|
|
317
|
+
<h3 class="tsd-anchor-link"><span>init<wbr/>Chat</span><a href="#initChat" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
318
|
+
<ul class="tsd-signatures">
|
|
319
|
+
<li class="tsd-signature tsd-anchor-link" id="initChat.initChat-1"><span class="tsd-kind-call-signature">init<wbr/>Chat</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">context</span>, <span class="tsd-kind-parameter">defaultValue</span>, <span class="tsd-kind-parameter">variables</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">defaultAiProvider</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../classes/TrackedChat.html" class="tsd-signature-type tsd-kind-class">TrackedChat</a><span class="tsd-signature-symbol">></span><a href="#initChat.initChat-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
320
|
+
<li class="tsd-description">
|
|
321
|
+
<div class="tsd-parameters">
|
|
322
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
323
|
+
<ul class="tsd-parameter-list">
|
|
324
|
+
<li>
|
|
325
|
+
<h5><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></h5></li>
|
|
326
|
+
<li>
|
|
327
|
+
<h5><span class="tsd-kind-parameter">context</span>: <span class="tsd-signature-type ">LDContext</span></h5></li>
|
|
328
|
+
<li>
|
|
329
|
+
<h5><span class="tsd-kind-parameter">defaultValue</span>: <a href="LDAICompletionConfigDefault.html" class="tsd-signature-type tsd-kind-interface">LDAICompletionConfigDefault</a></h5></li>
|
|
330
|
+
<li>
|
|
331
|
+
<h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">variables</span>: <span class="tsd-signature-type ">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></h5><code class="tsd-tag ts-flagOptional">Optional</code> </li>
|
|
332
|
+
<li>
|
|
333
|
+
<h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">defaultAiProvider</span>: <span class="tsd-signature-type">"openai"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"langchain"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"vercel"</span></h5><code class="tsd-tag ts-flagOptional">Optional</code> </li></ul></div>
|
|
334
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../classes/TrackedChat.html" class="tsd-signature-type tsd-kind-class">TrackedChat</a><span class="tsd-signature-symbol">></span></h4>
|
|
335
|
+
<div class="tsd-comment tsd-typography">
|
|
336
|
+
<h4>Deprecated</h4><p>Use <code>createChat</code> instead. This method will be removed in a future version.</p>
|
|
337
|
+
</div><aside class="tsd-sources">
|
|
338
|
+
<ul>
|
|
339
|
+
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/a51dcdb/packages/sdk/server-ai/src/api/LDAIClient.ts#L278">sdk/server-ai/src/api/LDAIClient.ts:278</a></li></ul></aside></li></ul></section>
|
|
340
|
+
<section class="tsd-panel tsd-member"><a id="judgeConfig" class="tsd-anchor"></a>
|
|
341
|
+
<h3 class="tsd-anchor-link"><span>judge<wbr/>Config</span><a href="#judgeConfig" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3>
|
|
342
|
+
<ul class="tsd-signatures">
|
|
343
|
+
<li class="tsd-signature tsd-anchor-link" id="judgeConfig.judgeConfig-1"><span class="tsd-kind-call-signature">judge<wbr/>Config</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">key</span>, <span class="tsd-kind-parameter">context</span>, <span class="tsd-kind-parameter">defaultValue</span>, <span class="tsd-kind-parameter">variables</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="LDAIJudgeConfig.html" class="tsd-signature-type tsd-kind-interface">LDAIJudgeConfig</a><span class="tsd-signature-symbol">></span><a href="#judgeConfig.judgeConfig-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li>
|
|
344
|
+
<li class="tsd-description">
|
|
345
|
+
<div class="tsd-comment tsd-typography"><p>Retrieves and processes a Judge AI Config based on the provided key, LaunchDarkly context,
|
|
346
|
+
and variables. This includes the model configuration and the customized messages for evaluation.</p>
|
|
347
|
+
</div>
|
|
348
|
+
<div class="tsd-parameters">
|
|
349
|
+
<h4 class="tsd-parameters-title">Parameters</h4>
|
|
350
|
+
<ul class="tsd-parameter-list">
|
|
351
|
+
<li>
|
|
352
|
+
<h5><span class="tsd-kind-parameter">key</span>: <span class="tsd-signature-type">string</span></h5>
|
|
353
|
+
<div class="tsd-comment tsd-typography"><p>The key of the Judge AI Config.</p>
|
|
354
|
+
</div></li>
|
|
355
|
+
<li>
|
|
356
|
+
<h5><span class="tsd-kind-parameter">context</span>: <span class="tsd-signature-type ">LDContext</span></h5>
|
|
357
|
+
<div class="tsd-comment tsd-typography"><p>The LaunchDarkly context object that contains relevant information about the
|
|
358
|
+
current environment, user, or session. This context may influence how the configuration is
|
|
359
|
+
processed or personalized.</p>
|
|
360
|
+
</div></li>
|
|
361
|
+
<li>
|
|
362
|
+
<h5><span class="tsd-kind-parameter">defaultValue</span>: <a href="LDAIJudgeConfigDefault.html" class="tsd-signature-type tsd-kind-interface">LDAIJudgeConfigDefault</a></h5>
|
|
363
|
+
<div class="tsd-comment tsd-typography"><p>A fallback value containing model configuration and messages. This will
|
|
364
|
+
be used if the configuration is not available from LaunchDarkly.</p>
|
|
365
|
+
</div></li>
|
|
366
|
+
<li>
|
|
367
|
+
<h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">variables</span>: <span class="tsd-signature-type ">Record</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><span class="tsd-signature-type">unknown</span><span class="tsd-signature-symbol">></span></h5>
|
|
368
|
+
<div class="tsd-comment tsd-typography"><p>Optional variables for template interpolation in messages and instructions.</p>
|
|
369
|
+
</div><code class="tsd-tag ts-flagOptional">Optional</code> </li></ul></div>
|
|
370
|
+
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type ">Promise</span><span class="tsd-signature-symbol"><</span><a href="LDAIJudgeConfig.html" class="tsd-signature-type tsd-kind-interface">LDAIJudgeConfig</a><span class="tsd-signature-symbol">></span></h4><p>A promise that resolves to a tracked judge configuration.</p>
|
|
371
|
+
|
|
372
|
+
<div class="tsd-comment tsd-typography">
|
|
373
|
+
<h4>Example</h4><pre><code class="language-typescript"><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">judgeConf</span><span class="hl-1"> = </span><span class="hl-5">await</span><span class="hl-1"> </span><span class="hl-4">client</span><span class="hl-1">.</span><span class="hl-6">judgeConfig</span><span class="hl-1">(</span><span class="hl-4">key</span><span class="hl-1">, </span><span class="hl-4">context</span><span class="hl-1">, {</span><br/><span class="hl-1"> </span><span class="hl-4">enabled:</span><span class="hl-1"> </span><span class="hl-0">true</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">model:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">'gpt-4'</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">provider:</span><span class="hl-1"> { </span><span class="hl-4">name:</span><span class="hl-1"> </span><span class="hl-3">'openai'</span><span class="hl-1"> },</span><br/><span class="hl-1"> </span><span class="hl-4">evaluationMetricKeys:</span><span class="hl-1"> [</span><span class="hl-3">'$ld:ai:judge:relevance'</span><span class="hl-1">],</span><br/><span class="hl-1"> </span><span class="hl-4">messages:</span><span class="hl-1"> [{ </span><span class="hl-4">role:</span><span class="hl-1"> </span><span class="hl-3">'system'</span><span class="hl-1">, </span><span class="hl-4">content:</span><span class="hl-1"> </span><span class="hl-3">'You are a relevance judge.'</span><span class="hl-1"> }]</span><br/><span class="hl-1">}, </span><span class="hl-4">variables</span><span class="hl-1">);</span><br/><br/><span class="hl-0">const</span><span class="hl-1"> </span><span class="hl-2">config</span><span class="hl-1"> = </span><span class="hl-4">judgeConf</span><span class="hl-1">.</span><span class="hl-4">config</span><span class="hl-1">; </span><span class="hl-7">// Interpolated configuration</span><br/><span class="hl-4">judgeConf</span><span class="hl-1">.</span><span class="hl-4">tracker</span><span class="hl-1">.</span><span class="hl-6">trackSuccess</span><span class="hl-1">();</span>
|
|
196
374
|
</code><button>Copy</button></pre>
|
|
197
375
|
</div><aside class="tsd-sources">
|
|
198
376
|
<ul>
|
|
199
|
-
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/
|
|
377
|
+
<li>Defined in <a href="https://github.com/launchdarkly/js-core/blob/a51dcdb/packages/sdk/server-ai/src/api/LDAIClient.ts#L167">sdk/server-ai/src/api/LDAIClient.ts:167</a></li></ul></aside></li></ul></section></section></div>
|
|
200
378
|
<div class="col-sidebar">
|
|
201
379
|
<div class="page-menu">
|
|
202
380
|
<div class="tsd-navigation settings">
|
|
@@ -217,34 +395,50 @@ This method serves as the primary entry point for creating TrackedChat instances
|
|
|
217
395
|
<div class="tsd-accordion-details">
|
|
218
396
|
<ul>
|
|
219
397
|
<li><a href="#agent" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>agent</span></a></li>
|
|
398
|
+
<li><a href="#agentConfig" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>agent<wbr/>Config</span></a></li>
|
|
399
|
+
<li><a href="#agentConfigs" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>agent<wbr/>Configs</span></a></li>
|
|
220
400
|
<li><a href="#agents" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>agents</span></a></li>
|
|
401
|
+
<li><a href="#completionConfig" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>completion<wbr/>Config</span></a></li>
|
|
221
402
|
<li><a href="#config" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>config</span></a></li>
|
|
222
|
-
<li><a href="#
|
|
403
|
+
<li><a href="#createChat" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>create<wbr/>Chat</span></a></li>
|
|
404
|
+
<li><a href="#createJudge" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>create<wbr/>Judge</span></a></li>
|
|
405
|
+
<li><a href="#initChat" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>init<wbr/>Chat</span></a></li>
|
|
406
|
+
<li><a href="#judgeConfig" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2048"></use></svg><span>judge<wbr/>Config</span></a></li></ul></div></details></div>
|
|
223
407
|
<div class="site-menu">
|
|
224
|
-
<nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-4"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z" fill="var(--color-text)"></path></g></svg><span>@launchdarkly/server-<wbr/>sdk-<wbr/>ai -<wbr/> v0.
|
|
408
|
+
<nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-4"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-namespace)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.33 16V7.24H10.77L13.446 14.74C13.43 14.54 13.41 14.296 13.386 14.008C13.37 13.712 13.354 13.404 13.338 13.084C13.33 12.756 13.326 12.448 13.326 12.16V7.24H14.37V16H12.93L10.266 8.5C10.282 8.692 10.298 8.936 10.314 9.232C10.33 9.52 10.342 9.828 10.35 10.156C10.366 10.476 10.374 10.784 10.374 11.08V16H9.33Z" fill="var(--color-text)"></path></g></svg><span>@launchdarkly/server-<wbr/>sdk-<wbr/>ai -<wbr/> v0.14.0</span></a>
|
|
225
409
|
<ul class="tsd-small-nested-navigation">
|
|
226
410
|
<li><a href="../enums/LDFeedbackKind.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-8"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-enum)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.45 16V7.24H14.49V8.224H10.518V10.936H14.07V11.908H10.518V15.016H14.49V16H9.45Z" fill="var(--color-text)"></path></g></svg><span>LDFeedback<wbr/>Kind</span></a></li>
|
|
227
411
|
<li><a href="../classes/AIProvider.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-128"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)"></path></g></svg><span>AIProvider</span></a></li>
|
|
228
412
|
<li><a href="../classes/AIProviderFactory.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg><span>AIProvider<wbr/>Factory</span></a></li>
|
|
413
|
+
<li><a href="../classes/Judge.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg><span>Judge</span></a></li>
|
|
229
414
|
<li><a href="../classes/TrackedChat.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-128"></use></svg><span>Tracked<wbr/>Chat</span></a></li>
|
|
230
415
|
<li><a href="ChatResponse.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-256"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-interface)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.51 16V15.016H11.298V8.224H9.51V7.24H14.19V8.224H12.402V15.016H14.19V16H9.51Z" fill="var(--color-text)"></path></g></svg><span>Chat<wbr/>Response</span></a></li>
|
|
231
|
-
<li><a href="
|
|
416
|
+
<li><a href="EvalScore.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>Eval<wbr/>Score</span></a></li>
|
|
417
|
+
<li><a href="JudgeResponse.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>Judge<wbr/>Response</span></a></li>
|
|
232
418
|
<li><a href="LDAIAgentConfig.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDAIAgent<wbr/>Config</span></a></li>
|
|
419
|
+
<li><a href="LDAIAgentConfigDefault.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDAIAgent<wbr/>Config<wbr/>Default</span></a></li>
|
|
420
|
+
<li><a href="LDAIAgentRequestConfig.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDAIAgent<wbr/>Request<wbr/>Config</span></a></li>
|
|
233
421
|
<li><a href="LDAIClient.html" class="current"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDAIClient</span></a></li>
|
|
422
|
+
<li><a href="LDAICompletionConfig.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDAICompletion<wbr/>Config</span></a></li>
|
|
423
|
+
<li><a href="LDAICompletionConfigDefault.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDAICompletion<wbr/>Config<wbr/>Default</span></a></li>
|
|
234
424
|
<li><a href="LDAIConfig.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDAIConfig</span></a></li>
|
|
425
|
+
<li><a href="LDAIConfigDefault.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDAIConfig<wbr/>Default</span></a></li>
|
|
235
426
|
<li><a href="LDAIConfigTracker.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDAIConfig<wbr/>Tracker</span></a></li>
|
|
427
|
+
<li><a href="LDAIJudgeConfig.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDAIJudge<wbr/>Config</span></a></li>
|
|
428
|
+
<li><a href="LDAIJudgeConfigDefault.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDAIJudge<wbr/>Config<wbr/>Default</span></a></li>
|
|
236
429
|
<li><a href="LDAIMetrics.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDAIMetrics</span></a></li>
|
|
430
|
+
<li><a href="LDJudge.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDJudge</span></a></li>
|
|
431
|
+
<li><a href="LDJudgeConfiguration.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDJudge<wbr/>Configuration</span></a></li>
|
|
237
432
|
<li><a href="LDLogger.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDLogger</span></a></li>
|
|
238
433
|
<li><a href="LDMessage.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDMessage</span></a></li>
|
|
239
434
|
<li><a href="LDModelConfig.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDModel<wbr/>Config</span></a></li>
|
|
240
435
|
<li><a href="LDProviderConfig.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDProvider<wbr/>Config</span></a></li>
|
|
241
436
|
<li><a href="LDTokenUsage.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>LDToken<wbr/>Usage</span></a></li>
|
|
242
|
-
<li><a href="
|
|
243
|
-
<li><a href="
|
|
244
|
-
<li><a href="../types/
|
|
245
|
-
<li><a href="../types/
|
|
437
|
+
<li><a href="StructuredResponse.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-256"></use></svg><span>Structured<wbr/>Response</span></a></li>
|
|
438
|
+
<li><a href="../types/LDAIConfigDefaultKind.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-2097152"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-type-alias)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)"></path></g></svg><span>LDAIConfig<wbr/>Default<wbr/>Kind</span></a></li>
|
|
439
|
+
<li><a href="../types/LDAIConfigKind.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2097152"></use></svg><span>LDAIConfig<wbr/>Kind</span></a></li>
|
|
440
|
+
<li><a href="../types/LDAIConfigMode.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2097152"></use></svg><span>LDAIConfig<wbr/>Mode</span></a></li>
|
|
246
441
|
<li><a href="../types/SupportedAIProvider.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2097152"></use></svg><span>SupportedAIProvider</span></a></li>
|
|
247
|
-
<li><a href="../types/VercelAISDKProvider.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2097152"></use></svg><span>VercelAISDKProvider</span></a></li>
|
|
248
442
|
<li><a href="../variables/SUPPORTED_AI_PROVIDERS.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-32"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z" fill="var(--color-text)"></path></g></svg><span>SUPPORTED_<wbr/>AI_<wbr/>PROVIDERS</span></a></li>
|
|
249
443
|
<li><a href="../functions/createBedrockTokenUsage.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><g id="icon-64"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)"></path></g></svg><span>create<wbr/>Bedrock<wbr/>Token<wbr/>Usage</span></a></li>
|
|
250
444
|
<li><a href="../functions/createOpenAiUsage.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-64"></use></svg><span>create<wbr/>Open<wbr/>Ai<wbr/>Usage</span></a></li>
|