Skip to content

Commit cf7582c

Browse files
author
Daniel OBrien
committed
update example
1 parent 76f25cc commit cf7582c

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

packages/sdk/ai/src/index.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,32 @@ export class AIClient {
3434
* @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.
3535
*
3636
* @example
37+
* ```
3738
* const key = "welcome_prompt";
3839
* const context = new LDContext(...);
3940
* const variables = new Record<string, string>([["username", "John"]]);
40-
* const defaultValue = "Welcome, user!";
41+
* const defaultValue = {}};
4142
*
42-
* const result = modelConfig(key, context, variables, defaultValue);
43+
* const result = modelConfig(key, context, defaultValue, variables);
4344
* console.log(result);
4445
* // 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."
58-
* // }
59-
* // ]
60-
* // }
46+
* {
47+
* modelId: "gpt-4o",
48+
* temperature: 0.2,
49+
* maxTokens: 4096,
50+
* userDefinedKey: "myValue",
51+
* prompt: [
52+
* {
53+
* role: "system",
54+
* content: "You are an amazing GPT."
55+
* },
56+
* {
57+
* role: "user",
58+
* content: "Explain how you're an amazing GPT."
59+
* }
60+
* ]
61+
* }
62+
* ```
6163
*/
6264
async modelConfig(
6365
key: string,

0 commit comments

Comments
 (0)