You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/sdk/ai/src/index.ts
+20-18Lines changed: 20 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -34,30 +34,32 @@ export class AIClient {
34
34
* @returns The processed prompt after all variables have been substituted in the stored prompt template. If the prompt cannot be retrieved or processed, the `defaultValue` is returned.
35
35
*
36
36
* @example
37
+
* ```
37
38
* const key = "welcome_prompt";
38
39
* const context = new LDContext(...);
39
40
* const variables = new Record<string, string>([["username", "John"]]);
40
-
* const defaultValue = "Welcome, user!";
41
+
* const defaultValue = {}};
41
42
*
42
-
* const result = modelConfig(key, context, variables, defaultValue);
43
+
* const result = modelConfig(key, context, defaultValue, variables);
43
44
* console.log(result);
44
45
* // Output:
45
-
* // {
46
-
* // modelId: "gpt-4o",
47
-
* // temperature: 0.2,
48
-
* // maxTokens: 4096,
49
-
* // userDefinedKey: "myValue",
50
-
* // prompt: [
51
-
* // {
52
-
* // role: "system",
53
-
* // content: "You are an amazing GPT."
54
-
* // },
55
-
* // {
56
-
* // role: "user",
57
-
* // content: "Explain how you're an amazing GPT."
0 commit comments