@launchdarkly/server-sdk-ai 0.16.5 → 0.16.7
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 +18 -0
- package/README.md +2 -6
- package/dist/index.cjs +25 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -22
- package/dist/index.d.ts +25 -22
- package/dist/index.js +25 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -367,7 +367,7 @@ interface LDJudgeConfiguration {
|
|
|
367
367
|
judges: LDJudge[];
|
|
368
368
|
}
|
|
369
369
|
/**
|
|
370
|
-
* Base AI Config
|
|
370
|
+
* Base AI Config for default implementations with optional enabled property.
|
|
371
371
|
*/
|
|
372
372
|
interface LDAIConfigDefault {
|
|
373
373
|
/**
|
|
@@ -514,9 +514,9 @@ interface LDAIAgentRequestConfig {
|
|
|
514
514
|
*/
|
|
515
515
|
key: string;
|
|
516
516
|
/**
|
|
517
|
-
* Default configuration for the agent.
|
|
517
|
+
* Default configuration for the agent. When omitted or null, a disabled default is used.
|
|
518
518
|
*/
|
|
519
|
-
defaultValue
|
|
519
|
+
defaultValue?: LDAIAgentConfigDefault;
|
|
520
520
|
/**
|
|
521
521
|
* Variables for instructions interpolation.
|
|
522
522
|
*/
|
|
@@ -768,8 +768,8 @@ interface LDAIClient {
|
|
|
768
768
|
* @param context The LaunchDarkly context object that contains relevant information about the
|
|
769
769
|
* current environment, user, or session. This context may influence how the configuration is
|
|
770
770
|
* processed or personalized.
|
|
771
|
-
* @param defaultValue
|
|
772
|
-
*
|
|
771
|
+
* @param defaultValue Optional fallback when the configuration is not available from LaunchDarkly.
|
|
772
|
+
* When omitted or null, a disabled default is used.
|
|
773
773
|
* @param variables A map of key-value pairs representing dynamic variables to be injected into
|
|
774
774
|
* the message content. The keys correspond to placeholders within the template, and the values
|
|
775
775
|
* are the corresponding replacements.
|
|
@@ -784,7 +784,7 @@ interface LDAIClient {
|
|
|
784
784
|
* const context = {...};
|
|
785
785
|
* const variables = {username: 'john'};
|
|
786
786
|
* const defaultValue = {
|
|
787
|
-
* enabled:
|
|
787
|
+
* enabled: true,
|
|
788
788
|
* model: { name: 'gpt-4' },
|
|
789
789
|
* provider: { name: 'openai' },
|
|
790
790
|
* };
|
|
@@ -813,11 +813,11 @@ interface LDAIClient {
|
|
|
813
813
|
* }
|
|
814
814
|
* ```
|
|
815
815
|
*/
|
|
816
|
-
completionConfig(key: string, context: LDContext, defaultValue
|
|
816
|
+
completionConfig(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>): Promise<LDAICompletionConfig>;
|
|
817
817
|
/**
|
|
818
818
|
* @deprecated Use `completionConfig` instead. This method will be removed in a future version.
|
|
819
819
|
*/
|
|
820
|
-
config(key: string, context: LDContext, defaultValue
|
|
820
|
+
config(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>): Promise<LDAICompletionConfig>;
|
|
821
821
|
/**
|
|
822
822
|
* Retrieves and processes a single AI Config agent based on the provided key, LaunchDarkly context,
|
|
823
823
|
* and variables. This includes the model configuration and the customized instructions.
|
|
@@ -826,7 +826,8 @@ interface LDAIClient {
|
|
|
826
826
|
* @param context The LaunchDarkly context object that contains relevant information about the
|
|
827
827
|
* current environment, user, or session. This context may influence how the configuration is
|
|
828
828
|
* processed or personalized.
|
|
829
|
-
* @param defaultValue
|
|
829
|
+
* @param defaultValue Optional fallback when the configuration is not available from LaunchDarkly.
|
|
830
|
+
* When omitted or null, a disabled default is used.
|
|
830
831
|
* @param variables A map of key-value pairs representing dynamic variables to be injected into
|
|
831
832
|
* the instructions. The keys correspond to placeholders within the template, and the values
|
|
832
833
|
* are the corresponding replacements.
|
|
@@ -851,11 +852,11 @@ interface LDAIClient {
|
|
|
851
852
|
* agentConfig.tracker.trackSuccess();
|
|
852
853
|
* ```
|
|
853
854
|
*/
|
|
854
|
-
agentConfig(key: string, context: LDContext, defaultValue
|
|
855
|
+
agentConfig(key: string, context: LDContext, defaultValue?: LDAIAgentConfigDefault, variables?: Record<string, unknown>): Promise<LDAIAgentConfig>;
|
|
855
856
|
/**
|
|
856
857
|
* @deprecated Use `agentConfig` instead. This method will be removed in a future version.
|
|
857
858
|
*/
|
|
858
|
-
agent(key: string, context: LDContext, defaultValue
|
|
859
|
+
agent(key: string, context: LDContext, defaultValue?: LDAIAgentConfigDefault, variables?: Record<string, unknown>): Promise<LDAIAgentConfig>;
|
|
859
860
|
/**
|
|
860
861
|
* Retrieves and processes a Judge AI Config based on the provided key, LaunchDarkly context,
|
|
861
862
|
* and variables. This includes the model configuration and the customized messages for evaluation.
|
|
@@ -864,8 +865,8 @@ interface LDAIClient {
|
|
|
864
865
|
* @param context The LaunchDarkly context object that contains relevant information about the
|
|
865
866
|
* current environment, user, or session. This context may influence how the configuration is
|
|
866
867
|
* processed or personalized.
|
|
867
|
-
* @param defaultValue
|
|
868
|
-
*
|
|
868
|
+
* @param defaultValue Optional fallback when the configuration is not available from LaunchDarkly.
|
|
869
|
+
* When omitted or null, a disabled default is used.
|
|
869
870
|
* @param variables Optional variables for template interpolation in messages and instructions.
|
|
870
871
|
* @returns A promise that resolves to a tracked judge configuration.
|
|
871
872
|
*
|
|
@@ -883,13 +884,13 @@ interface LDAIClient {
|
|
|
883
884
|
* judgeConf.tracker.trackSuccess();
|
|
884
885
|
* ```
|
|
885
886
|
*/
|
|
886
|
-
judgeConfig(key: string, context: LDContext, defaultValue
|
|
887
|
+
judgeConfig(key: string, context: LDContext, defaultValue?: LDAIJudgeConfigDefault, variables?: Record<string, unknown>): Promise<LDAIJudgeConfig>;
|
|
887
888
|
/**
|
|
888
889
|
* Retrieves and processes multiple AI Config agents based on the provided agent configurations
|
|
889
890
|
* and LaunchDarkly context. This includes the model configuration and the customized instructions.
|
|
890
891
|
*
|
|
891
|
-
* @param agentConfigs An array of agent configurations, each containing the agent key, default
|
|
892
|
-
* and variables for instructions interpolation.
|
|
892
|
+
* @param agentConfigs An array of agent configurations, each containing the agent key, optional default
|
|
893
|
+
* configuration (when omitted or null, a disabled default is used), and variables for instructions interpolation.
|
|
893
894
|
* @param context The LaunchDarkly context object that contains relevant information about the
|
|
894
895
|
* current environment, user, or session. This context may influence how the configuration is
|
|
895
896
|
* processed or personalized.
|
|
@@ -941,7 +942,8 @@ interface LDAIClient {
|
|
|
941
942
|
*
|
|
942
943
|
* @param key The key identifying the AI chat configuration to use.
|
|
943
944
|
* @param context The standard LDContext used when evaluating flags.
|
|
944
|
-
* @param defaultValue
|
|
945
|
+
* @param defaultValue Optional fallback when the configuration is not available from LaunchDarkly.
|
|
946
|
+
* When omitted or null, a disabled default is used.
|
|
945
947
|
* @param variables Dictionary of values for instruction interpolation.
|
|
946
948
|
* The variables will also be used for judge evaluation. For the judge only, the variables
|
|
947
949
|
* `message_history` and `response_to_evaluate` are reserved and will be ignored.
|
|
@@ -953,7 +955,7 @@ interface LDAIClient {
|
|
|
953
955
|
* const key = "customer_support_chat";
|
|
954
956
|
* const context = {...};
|
|
955
957
|
* const defaultValue = {
|
|
956
|
-
* enabled:
|
|
958
|
+
* enabled: true,
|
|
957
959
|
* model: { name: "gpt-4" },
|
|
958
960
|
* provider: { name: "openai" },
|
|
959
961
|
* messages: [
|
|
@@ -969,17 +971,18 @@ interface LDAIClient {
|
|
|
969
971
|
* }
|
|
970
972
|
* ```
|
|
971
973
|
*/
|
|
972
|
-
createChat(key: string, context: LDContext, defaultValue
|
|
974
|
+
createChat(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<TrackedChat | undefined>;
|
|
973
975
|
/**
|
|
974
976
|
* @deprecated Use `createChat` instead. This method will be removed in a future version.
|
|
975
977
|
*/
|
|
976
|
-
initChat(key: string, context: LDContext, defaultValue
|
|
978
|
+
initChat(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<TrackedChat | undefined>;
|
|
977
979
|
/**
|
|
978
980
|
* Creates and returns a new Judge instance for AI evaluation.
|
|
979
981
|
*
|
|
980
982
|
* @param key The key identifying the AI judge configuration to use
|
|
981
983
|
* @param context Standard LDContext used when evaluating flags
|
|
982
|
-
* @param defaultValue
|
|
984
|
+
* @param defaultValue Optional fallback when the configuration is not available from LaunchDarkly.
|
|
985
|
+
* When omitted or null, a disabled default is used.
|
|
983
986
|
* @param variables Dictionary of values for instruction interpolation.
|
|
984
987
|
* The variables `message_history` and `response_to_evaluate` are reserved for the judge and will be ignored.
|
|
985
988
|
* @param defaultAiProvider Optional default AI provider to use.
|
|
@@ -1006,7 +1009,7 @@ interface LDAIClient {
|
|
|
1006
1009
|
* }
|
|
1007
1010
|
* ```
|
|
1008
1011
|
*/
|
|
1009
|
-
createJudge(key: string, context: LDContext, defaultValue
|
|
1012
|
+
createJudge(key: string, context: LDContext, defaultValue?: LDAIJudgeConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<Judge | undefined>;
|
|
1010
1013
|
}
|
|
1011
1014
|
|
|
1012
1015
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -367,7 +367,7 @@ interface LDJudgeConfiguration {
|
|
|
367
367
|
judges: LDJudge[];
|
|
368
368
|
}
|
|
369
369
|
/**
|
|
370
|
-
* Base AI Config
|
|
370
|
+
* Base AI Config for default implementations with optional enabled property.
|
|
371
371
|
*/
|
|
372
372
|
interface LDAIConfigDefault {
|
|
373
373
|
/**
|
|
@@ -514,9 +514,9 @@ interface LDAIAgentRequestConfig {
|
|
|
514
514
|
*/
|
|
515
515
|
key: string;
|
|
516
516
|
/**
|
|
517
|
-
* Default configuration for the agent.
|
|
517
|
+
* Default configuration for the agent. When omitted or null, a disabled default is used.
|
|
518
518
|
*/
|
|
519
|
-
defaultValue
|
|
519
|
+
defaultValue?: LDAIAgentConfigDefault;
|
|
520
520
|
/**
|
|
521
521
|
* Variables for instructions interpolation.
|
|
522
522
|
*/
|
|
@@ -768,8 +768,8 @@ interface LDAIClient {
|
|
|
768
768
|
* @param context The LaunchDarkly context object that contains relevant information about the
|
|
769
769
|
* current environment, user, or session. This context may influence how the configuration is
|
|
770
770
|
* processed or personalized.
|
|
771
|
-
* @param defaultValue
|
|
772
|
-
*
|
|
771
|
+
* @param defaultValue Optional fallback when the configuration is not available from LaunchDarkly.
|
|
772
|
+
* When omitted or null, a disabled default is used.
|
|
773
773
|
* @param variables A map of key-value pairs representing dynamic variables to be injected into
|
|
774
774
|
* the message content. The keys correspond to placeholders within the template, and the values
|
|
775
775
|
* are the corresponding replacements.
|
|
@@ -784,7 +784,7 @@ interface LDAIClient {
|
|
|
784
784
|
* const context = {...};
|
|
785
785
|
* const variables = {username: 'john'};
|
|
786
786
|
* const defaultValue = {
|
|
787
|
-
* enabled:
|
|
787
|
+
* enabled: true,
|
|
788
788
|
* model: { name: 'gpt-4' },
|
|
789
789
|
* provider: { name: 'openai' },
|
|
790
790
|
* };
|
|
@@ -813,11 +813,11 @@ interface LDAIClient {
|
|
|
813
813
|
* }
|
|
814
814
|
* ```
|
|
815
815
|
*/
|
|
816
|
-
completionConfig(key: string, context: LDContext, defaultValue
|
|
816
|
+
completionConfig(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>): Promise<LDAICompletionConfig>;
|
|
817
817
|
/**
|
|
818
818
|
* @deprecated Use `completionConfig` instead. This method will be removed in a future version.
|
|
819
819
|
*/
|
|
820
|
-
config(key: string, context: LDContext, defaultValue
|
|
820
|
+
config(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>): Promise<LDAICompletionConfig>;
|
|
821
821
|
/**
|
|
822
822
|
* Retrieves and processes a single AI Config agent based on the provided key, LaunchDarkly context,
|
|
823
823
|
* and variables. This includes the model configuration and the customized instructions.
|
|
@@ -826,7 +826,8 @@ interface LDAIClient {
|
|
|
826
826
|
* @param context The LaunchDarkly context object that contains relevant information about the
|
|
827
827
|
* current environment, user, or session. This context may influence how the configuration is
|
|
828
828
|
* processed or personalized.
|
|
829
|
-
* @param defaultValue
|
|
829
|
+
* @param defaultValue Optional fallback when the configuration is not available from LaunchDarkly.
|
|
830
|
+
* When omitted or null, a disabled default is used.
|
|
830
831
|
* @param variables A map of key-value pairs representing dynamic variables to be injected into
|
|
831
832
|
* the instructions. The keys correspond to placeholders within the template, and the values
|
|
832
833
|
* are the corresponding replacements.
|
|
@@ -851,11 +852,11 @@ interface LDAIClient {
|
|
|
851
852
|
* agentConfig.tracker.trackSuccess();
|
|
852
853
|
* ```
|
|
853
854
|
*/
|
|
854
|
-
agentConfig(key: string, context: LDContext, defaultValue
|
|
855
|
+
agentConfig(key: string, context: LDContext, defaultValue?: LDAIAgentConfigDefault, variables?: Record<string, unknown>): Promise<LDAIAgentConfig>;
|
|
855
856
|
/**
|
|
856
857
|
* @deprecated Use `agentConfig` instead. This method will be removed in a future version.
|
|
857
858
|
*/
|
|
858
|
-
agent(key: string, context: LDContext, defaultValue
|
|
859
|
+
agent(key: string, context: LDContext, defaultValue?: LDAIAgentConfigDefault, variables?: Record<string, unknown>): Promise<LDAIAgentConfig>;
|
|
859
860
|
/**
|
|
860
861
|
* Retrieves and processes a Judge AI Config based on the provided key, LaunchDarkly context,
|
|
861
862
|
* and variables. This includes the model configuration and the customized messages for evaluation.
|
|
@@ -864,8 +865,8 @@ interface LDAIClient {
|
|
|
864
865
|
* @param context The LaunchDarkly context object that contains relevant information about the
|
|
865
866
|
* current environment, user, or session. This context may influence how the configuration is
|
|
866
867
|
* processed or personalized.
|
|
867
|
-
* @param defaultValue
|
|
868
|
-
*
|
|
868
|
+
* @param defaultValue Optional fallback when the configuration is not available from LaunchDarkly.
|
|
869
|
+
* When omitted or null, a disabled default is used.
|
|
869
870
|
* @param variables Optional variables for template interpolation in messages and instructions.
|
|
870
871
|
* @returns A promise that resolves to a tracked judge configuration.
|
|
871
872
|
*
|
|
@@ -883,13 +884,13 @@ interface LDAIClient {
|
|
|
883
884
|
* judgeConf.tracker.trackSuccess();
|
|
884
885
|
* ```
|
|
885
886
|
*/
|
|
886
|
-
judgeConfig(key: string, context: LDContext, defaultValue
|
|
887
|
+
judgeConfig(key: string, context: LDContext, defaultValue?: LDAIJudgeConfigDefault, variables?: Record<string, unknown>): Promise<LDAIJudgeConfig>;
|
|
887
888
|
/**
|
|
888
889
|
* Retrieves and processes multiple AI Config agents based on the provided agent configurations
|
|
889
890
|
* and LaunchDarkly context. This includes the model configuration and the customized instructions.
|
|
890
891
|
*
|
|
891
|
-
* @param agentConfigs An array of agent configurations, each containing the agent key, default
|
|
892
|
-
* and variables for instructions interpolation.
|
|
892
|
+
* @param agentConfigs An array of agent configurations, each containing the agent key, optional default
|
|
893
|
+
* configuration (when omitted or null, a disabled default is used), and variables for instructions interpolation.
|
|
893
894
|
* @param context The LaunchDarkly context object that contains relevant information about the
|
|
894
895
|
* current environment, user, or session. This context may influence how the configuration is
|
|
895
896
|
* processed or personalized.
|
|
@@ -941,7 +942,8 @@ interface LDAIClient {
|
|
|
941
942
|
*
|
|
942
943
|
* @param key The key identifying the AI chat configuration to use.
|
|
943
944
|
* @param context The standard LDContext used when evaluating flags.
|
|
944
|
-
* @param defaultValue
|
|
945
|
+
* @param defaultValue Optional fallback when the configuration is not available from LaunchDarkly.
|
|
946
|
+
* When omitted or null, a disabled default is used.
|
|
945
947
|
* @param variables Dictionary of values for instruction interpolation.
|
|
946
948
|
* The variables will also be used for judge evaluation. For the judge only, the variables
|
|
947
949
|
* `message_history` and `response_to_evaluate` are reserved and will be ignored.
|
|
@@ -953,7 +955,7 @@ interface LDAIClient {
|
|
|
953
955
|
* const key = "customer_support_chat";
|
|
954
956
|
* const context = {...};
|
|
955
957
|
* const defaultValue = {
|
|
956
|
-
* enabled:
|
|
958
|
+
* enabled: true,
|
|
957
959
|
* model: { name: "gpt-4" },
|
|
958
960
|
* provider: { name: "openai" },
|
|
959
961
|
* messages: [
|
|
@@ -969,17 +971,18 @@ interface LDAIClient {
|
|
|
969
971
|
* }
|
|
970
972
|
* ```
|
|
971
973
|
*/
|
|
972
|
-
createChat(key: string, context: LDContext, defaultValue
|
|
974
|
+
createChat(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<TrackedChat | undefined>;
|
|
973
975
|
/**
|
|
974
976
|
* @deprecated Use `createChat` instead. This method will be removed in a future version.
|
|
975
977
|
*/
|
|
976
|
-
initChat(key: string, context: LDContext, defaultValue
|
|
978
|
+
initChat(key: string, context: LDContext, defaultValue?: LDAICompletionConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<TrackedChat | undefined>;
|
|
977
979
|
/**
|
|
978
980
|
* Creates and returns a new Judge instance for AI evaluation.
|
|
979
981
|
*
|
|
980
982
|
* @param key The key identifying the AI judge configuration to use
|
|
981
983
|
* @param context Standard LDContext used when evaluating flags
|
|
982
|
-
* @param defaultValue
|
|
984
|
+
* @param defaultValue Optional fallback when the configuration is not available from LaunchDarkly.
|
|
985
|
+
* When omitted or null, a disabled default is used.
|
|
983
986
|
* @param variables Dictionary of values for instruction interpolation.
|
|
984
987
|
* The variables `message_history` and `response_to_evaluate` are reserved for the judge and will be ignored.
|
|
985
988
|
* @param defaultAiProvider Optional default AI provider to use.
|
|
@@ -1006,7 +1009,7 @@ interface LDAIClient {
|
|
|
1006
1009
|
* }
|
|
1007
1010
|
* ```
|
|
1008
1011
|
*/
|
|
1009
|
-
createJudge(key: string, context: LDContext, defaultValue
|
|
1012
|
+
createJudge(key: string, context: LDContext, defaultValue?: LDAIJudgeConfigDefault, variables?: Record<string, unknown>, defaultAiProvider?: SupportedAIProvider): Promise<Judge | undefined>;
|
|
1010
1013
|
}
|
|
1011
1014
|
|
|
1012
1015
|
/**
|
package/dist/index.js
CHANGED
|
@@ -883,7 +883,7 @@ var LDAIConfigTrackerImpl = class {
|
|
|
883
883
|
|
|
884
884
|
// src/sdkInfo.ts
|
|
885
885
|
var aiSdkName = "@launchdarkly/server-sdk-ai";
|
|
886
|
-
var aiSdkVersion = "0.16.
|
|
886
|
+
var aiSdkVersion = "0.16.7";
|
|
887
887
|
var aiSdkLanguage = "javascript";
|
|
888
888
|
|
|
889
889
|
// src/LDAIClientImpl.ts
|
|
@@ -899,6 +899,7 @@ var INIT_TRACK_CONTEXT = {
|
|
|
899
899
|
key: "ld-internal-tracking",
|
|
900
900
|
anonymous: true
|
|
901
901
|
};
|
|
902
|
+
var disabledAIConfig = { enabled: false };
|
|
902
903
|
var LDAIClientImpl = class {
|
|
903
904
|
constructor(_ldClient) {
|
|
904
905
|
this._ldClient = _ldClient;
|
|
@@ -966,7 +967,7 @@ var LDAIClientImpl = class {
|
|
|
966
967
|
const judge = await this.createJudge(
|
|
967
968
|
judgeConfig.key,
|
|
968
969
|
context,
|
|
969
|
-
|
|
970
|
+
void 0,
|
|
970
971
|
variables,
|
|
971
972
|
defaultAiProvider
|
|
972
973
|
);
|
|
@@ -986,7 +987,7 @@ var LDAIClientImpl = class {
|
|
|
986
987
|
}
|
|
987
988
|
async completionConfig(key, context, defaultValue, variables) {
|
|
988
989
|
this._ldClient.track(TRACK_USAGE_COMPLETION_CONFIG, context, key, 1);
|
|
989
|
-
return this._completionConfig(key, context, defaultValue, variables);
|
|
990
|
+
return this._completionConfig(key, context, defaultValue ?? disabledAIConfig, variables);
|
|
990
991
|
}
|
|
991
992
|
/**
|
|
992
993
|
* @deprecated Use `completionConfig` instead. This method will be removed in a future version.
|
|
@@ -1000,11 +1001,17 @@ var LDAIClientImpl = class {
|
|
|
1000
1001
|
}
|
|
1001
1002
|
async judgeConfig(key, context, defaultValue, variables) {
|
|
1002
1003
|
this._ldClient.track(TRACK_USAGE_JUDGE_CONFIG, context, key, 1);
|
|
1003
|
-
return this._judgeConfig(key, context, defaultValue, variables);
|
|
1004
|
+
return this._judgeConfig(key, context, defaultValue ?? disabledAIConfig, variables);
|
|
1004
1005
|
}
|
|
1005
1006
|
async agentConfig(key, context, defaultValue, variables) {
|
|
1006
1007
|
this._ldClient.track(TRACK_USAGE_AGENT_CONFIG, context, key, 1);
|
|
1007
|
-
const config = await this._evaluate(
|
|
1008
|
+
const config = await this._evaluate(
|
|
1009
|
+
key,
|
|
1010
|
+
context,
|
|
1011
|
+
defaultValue ?? disabledAIConfig,
|
|
1012
|
+
"agent",
|
|
1013
|
+
variables
|
|
1014
|
+
);
|
|
1008
1015
|
return config;
|
|
1009
1016
|
}
|
|
1010
1017
|
/**
|
|
@@ -1026,7 +1033,7 @@ var LDAIClientImpl = class {
|
|
|
1026
1033
|
const agent = await this._evaluate(
|
|
1027
1034
|
config.key,
|
|
1028
1035
|
context,
|
|
1029
|
-
config.defaultValue,
|
|
1036
|
+
config.defaultValue ?? disabledAIConfig,
|
|
1030
1037
|
"agent",
|
|
1031
1038
|
config.variables
|
|
1032
1039
|
);
|
|
@@ -1043,7 +1050,12 @@ var LDAIClientImpl = class {
|
|
|
1043
1050
|
}
|
|
1044
1051
|
async createChat(key, context, defaultValue, variables, defaultAiProvider) {
|
|
1045
1052
|
this._ldClient.track(TRACK_USAGE_CREATE_CHAT, context, key, 1);
|
|
1046
|
-
const config = await this._completionConfig(
|
|
1053
|
+
const config = await this._completionConfig(
|
|
1054
|
+
key,
|
|
1055
|
+
context,
|
|
1056
|
+
defaultValue ?? disabledAIConfig,
|
|
1057
|
+
variables
|
|
1058
|
+
);
|
|
1047
1059
|
if (!config.enabled || !config.tracker) {
|
|
1048
1060
|
this._logger?.info(`Chat configuration is disabled: ${key}`);
|
|
1049
1061
|
return void 0;
|
|
@@ -1078,7 +1090,12 @@ var LDAIClientImpl = class {
|
|
|
1078
1090
|
message_history: "{{message_history}}",
|
|
1079
1091
|
response_to_evaluate: "{{response_to_evaluate}}"
|
|
1080
1092
|
};
|
|
1081
|
-
const judgeConfig = await this._judgeConfig(
|
|
1093
|
+
const judgeConfig = await this._judgeConfig(
|
|
1094
|
+
key,
|
|
1095
|
+
context,
|
|
1096
|
+
defaultValue ?? disabledAIConfig,
|
|
1097
|
+
extendedVariables
|
|
1098
|
+
);
|
|
1082
1099
|
if (!judgeConfig.enabled || !judgeConfig.tracker) {
|
|
1083
1100
|
this._logger?.info(`Judge configuration is disabled: ${key}`);
|
|
1084
1101
|
return void 0;
|