Skip to content

Commit ef43c50

Browse files
committed
update name of AI SDK example to be non provider specific
1 parent 64bdd6c commit ef43c50

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
"packages/sdk/server-ai",
3434
"packages/sdk/server-ai/examples/bedrock",
3535
"packages/sdk/server-ai/examples/openai",
36+
"packages/sdk/server-ai/examples/tracked-chat",
3637
"packages/sdk/server-ai/examples/vercel-ai",
37-
"packages/sdk/server-ai/examples/langchain-chat",
3838
"packages/telemetry/browser-telemetry",
3939
"contract-tests",
4040
"packages/sdk/combined-browser"

packages/sdk/server-ai/examples/langchain-chat/README.md renamed to packages/sdk/server-ai/examples/tracked-chat/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# LangChain Chat Example
1+
# Tracked Chat Example
22

3-
This example demonstrates how to use the LaunchDarkly AI SDK with LangChain for chat interactions.
3+
This example demonstrates how to use the LaunchDarkly AI SDK chat functionality with multiple providers for tracked chat interactions.
44

55
## Prerequisites
66

77
1. A LaunchDarkly account and SDK key
8-
1. An OpenAI API key (for the LangChain integration)
8+
1. An OpenAI API key (for the AI provider)
99
1. Node.js 16 or later
1010

1111
## Setup
@@ -72,5 +72,5 @@ This will:
7272
- **AI Config Integration**: Using LaunchDarkly to configure AI models and prompts
7373
- **Variable Interpolation**: Using Mustache templates with runtime variables
7474
- **Chat Conversations**: Multi-turn conversations with message history
75-
- **Provider Integration**: Using LangChain as the AI provider
75+
- **Provider Integration**: Using multiple AI providers through the LaunchDarkly AI SDK
7676
- **Metrics Tracking**: Automatic tracking of token usage and performance

packages/sdk/server-ai/examples/langchain-chat/package.json renamed to packages/sdk/server-ai/examples/tracked-chat/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
{
2-
"name": "langchain-chat-example",
2+
"name": "tracked-chat-example",
33
"version": "1.0.0",
4-
"description": "Example demonstrating LaunchDarkly AI SDK with LangChain",
4+
"description": "Example demonstrating LaunchDarkly AI SDK chat functionality with multiple providers",
55
"type": "module",
66
"scripts": {
77
"build": "tsc",
88
"start": "yarn build && node ./dist/index.js"
99
},
1010
"dependencies": {
11+
"@ai-sdk/google": "^2.0.20",
1112
"@langchain/core": "^0.3.78",
1213
"@langchain/google-genai": "^0.2.18",
1314
"@launchdarkly/node-server-sdk": "^9.0.0",
1415
"@launchdarkly/server-sdk-ai": "0.11.4",
15-
"@launchdarkly/server-sdk-ai-langchain": "0.1.0",
16+
"@launchdarkly/server-sdk-ai-langchain": "0.0.0",
17+
"@launchdarkly/server-sdk-ai-vercel": "0.0.0",
1618
"dotenv": "^16.0.0",
1719
"langchain": "^0.1.0"
1820
},

packages/sdk/server-ai/examples/langchain-chat/src/index.ts renamed to packages/sdk/server-ai/examples/tracked-chat/src/index.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
/* eslint-disable no-console */
2-
import { init, type LDContext } from '@launchdarkly/node-server-sdk';
2+
import {
3+
basicLogger,
4+
init,
5+
type LDContext,
6+
LDLogger,
7+
LDOptions,
8+
} from '@launchdarkly/node-server-sdk';
39
import { initAi } from '@launchdarkly/server-sdk-ai';
410

511
// Environment variables
@@ -12,8 +18,13 @@ if (!sdkKey) {
1218
process.exit(1);
1319
}
1420

21+
const logger = basicLogger({ level: 'debug', destination: console.log });
22+
const options: LDOptions = {
23+
logger,
24+
};
25+
1526
// Initialize LaunchDarkly client
16-
const ldClient = init(sdkKey);
27+
const ldClient = init(sdkKey, options);
1728

1829
// Set up the context properties. This context should appear on your LaunchDarkly contexts dashboard
1930
// soon after you run the demo.

0 commit comments

Comments
 (0)