Skip to content

Commit b36dd5b

Browse files
Add the OpenInference (Arize Phoenix) support (#114)
* Add the OpenInference (Arize Phoenix) support. * Fix the type errors * Update basic/cdk/test/index.test.ts Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com> --------- Co-authored-by: amazon-q-developer[bot] <208079219+amazon-q-developer[bot]@users.noreply.github.com>
1 parent 5799448 commit b36dd5b

38 files changed

Lines changed: 1782 additions & 1147 deletions

File tree

.github/workflows/auto-merge.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ permissions:
99

1010
jobs:
1111
pull-request-auto-merge:
12+
if: ${{ !github.event.pull_request.draft }}
1213
runs-on: ubuntu-latest
1314
steps:
1415
- uses: actions/checkout@v5

agents/agent-mastra/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@
1515
"type": "module",
1616
"dependencies": {
1717
"@ai-sdk/amazon-bedrock": "^3.0.22",
18-
"@ai-sdk/azure": "^2.0.30",
18+
"@ai-sdk/azure": "^2.0.32",
1919
"@mastra/core": "^0.16.3",
20-
"@mastra/libsql": "^0.14.1",
21-
"@mastra/loggers": "^0.10.11",
20+
"@mastra/libsql": "^0.14.2",
21+
"@mastra/loggers": "^0.10.12",
2222
"@mastra/mcp": "^0.12.0",
23-
"@mastra/memory": "^0.15.1",
23+
"@mastra/memory": "^0.15.2",
2424
"langfuse-vercel": "^3.38.5",
2525
"zod": "^3.25.76"
2626
},
2727
"devDependencies": {
2828
"@eslint/compat": "^1.3.2",
2929
"@eslint/js": "^9.35.0",
3030
"@stylistic/eslint-plugin": "^5.3.1",
31-
"@types/node": "^22.18.4",
31+
"@types/node": "^22.18.6",
3232
"eslint": "^9.35.0",
3333
"eslint-import-resolver-typescript": "^4.4.4",
3434
"eslint-plugin-import": "^2.32.0",
3535
"eslint-plugin-promise": "^7.2.1",
3636
"mastra": "^0.12.3",
37-
"pnpm": "^10.16.1",
37+
"pnpm": "^10.17.0",
3838
"typescript": "^5.9.2",
3939
"typescript-eslint": "^8.44.0"
4040
}

agents/agent-voltagent/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"zod": "3.24.2"
2424
},
2525
"devDependencies": {
26-
"@types/node": "^22.18.4",
26+
"@types/node": "^22.18.6",
2727
"tsx": "^4.20.5",
2828
"typescript": "^5.9.2"
2929
}

agents/langgraph-deep-agent/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"@eslint/compat": "^1.3.2",
1414
"@eslint/js": "^9.35.0",
1515
"@stylistic/eslint-plugin": "^5.3.1",
16-
"@types/node": "^22.18.4",
16+
"@types/node": "^22.18.6",
1717
"@types/uuid": "^10.0.0",
18-
"@vitest/eslint-plugin": "^1.3.10",
18+
"@vitest/eslint-plugin": "^1.3.12",
1919
"dotenv": "^16.6.1",
2020
"eslint": "^9.35.0",
2121
"eslint-import-resolver-typescript": "^4.4.4",
@@ -29,13 +29,13 @@
2929
"vitest": "^3.2.4"
3030
},
3131
"dependencies": {
32-
"@aws-sdk/credential-provider-node": "^3.888.0",
32+
"@aws-sdk/credential-provider-node": "^3.891.0",
3333
"@langchain/anthropic": "^0.3.28",
3434
"@langchain/aws": "^0.1.15",
3535
"@langchain/community": "^0.3.56",
3636
"@langchain/langgraph": "^0.4.9",
3737
"@langchain/mcp-adapters": "^0.6.0",
38-
"@langchain/openai": "^0.6.12",
38+
"@langchain/openai": "^0.6.13",
3939
"@smithy/eventstream-codec": "^2.2.0",
4040
"deepagents": "^0.0.2"
4141
}

basic/app/eslint.config.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// @ts-check
22

3+
import { defineConfig } from 'eslint/config';
34
import eslint from '@eslint/js';
45
import stylistic from '@stylistic/eslint-plugin';
5-
import tseslint from 'typescript-eslint';
6+
import { configs, parser } from 'typescript-eslint';
67
import importPlugin from 'eslint-plugin-import';
78

89
import pluginPromise from 'eslint-plugin-promise'
@@ -17,7 +18,7 @@ const __filename = fileURLToPath(import.meta.url);
1718
const __dirname = path.dirname(__filename);
1819
const gitignorePath = path.resolve(__dirname, '.gitignore');
1920

20-
export default tseslint.config(
21+
export default defineConfig(
2122
includeIgnoreFile(gitignorePath),
2223
{
2324
ignores: [
@@ -31,24 +32,22 @@ export default tseslint.config(
3132
],
3233
},
3334
eslint.configs.recommended,
34-
...tseslint.configs.strict,
35-
...tseslint.configs.stylistic,
35+
...configs.strict,
36+
...configs.stylistic,
3637
pluginPromise.configs['flat/recommended'],
3738
{
3839
files: ['src/**/*.{ts,tsx}'],
3940
languageOptions: {
40-
parser: tseslint.parser,
41+
parser,
4142
ecmaVersion: 'latest',
4243
sourceType: 'module',
4344
parserOptions: {
44-
projectService: true,
4545
tsconfigRootDir: __dirname,
46+
project: ['./tsconfig.json'],
4647
},
4748
},
4849
plugins: {
4950
'@stylistic': stylistic,
50-
'@stylistic/ts': stylistic,
51-
'@stylistic/jsx': stylistic,
5251
solid,
5352
},
5453
extends: [importPlugin.flatConfigs.recommended, importPlugin.flatConfigs.typescript],

basic/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"@solidjs/router": "^0.15.3",
2525
"@stylistic/eslint-plugin": "^5.3.1",
2626
"@types/crypto-js": "^4.2.2",
27-
"@types/node": "^22.18.4",
27+
"@types/node": "^22.18.6",
2828
"@types/uuid": "^10.0.0",
2929
"crypto-js": "^4.2.0",
3030
"eslint": "^9.35.0",

basic/cdk/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ cdk.out
1414
!*.config.js
1515
.env*
1616
vite.config.js
17+
eslint.config.js

basic/cdk/README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1-
# cloudfront-cdn-template
1+
# Basic Chatbot by LangChain.js on AWS Lambda Functions
22

33
## deploy
44

55
```sh
6-
yarn install && \
7-
cdk deploy
6+
pnpm install && \
7+
pnpm dlx aws-cdk@latest deploy
88
```
9+
10+
### Option
11+
12+
#### OpenInference
13+
14+
以下の環境変数に `true` を指定すると、[OpenInference](https://github.com/Arize-ai/openinference/) による OpenTelemetry (OTel) Tracing の Export が有効になります。
15+
16+
- `ENABLED_OPENINFERENCE_TELEMETRY`
17+
18+
また、OpenInferenceのトレースは環境変数`COLLECTOR_ENDPOINT`で指定された OTel Collector にgRPCで伝送されます。
19+
環境変数`COLLECTOR_ENDPOINT`が未指定の場合は`http://localhost:6006/v1/traces`が使用されます。
20+
21+
ただし、環境変数`ENABLED_OPENINFERENCE_TELEMETRY``true`を指定した場合に限ります。
Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
// @ts-check
2-
1+
import { defineConfig } from 'eslint/config';
32
import eslint from '@eslint/js';
43
import stylistic from '@stylistic/eslint-plugin';
5-
import tseslint from 'typescript-eslint';
4+
import { configs, parser } from 'typescript-eslint';
65
import eslintImport from 'eslint-plugin-import';
76

8-
import vitest from '@vitest/eslint-plugin';
9-
107
import { includeIgnoreFile } from '@eslint/compat';
118
import path from 'node:path';
129
import { fileURLToPath } from 'node:url';
@@ -15,7 +12,7 @@ const __filename = fileURLToPath(import.meta.url);
1512
const __dirname = path.dirname(__filename);
1613
const gitignorePath = path.resolve(__dirname, '.gitignore');
1714

18-
const config = tseslint.config(
15+
const config = defineConfig(
1916
includeIgnoreFile(gitignorePath),
2017
{
2118
ignores: [
@@ -29,42 +26,41 @@ const config = tseslint.config(
2926
],
3027
},
3128
eslint.configs.recommended,
32-
...tseslint.configs.strict,
33-
...tseslint.configs.stylistic,
29+
...configs.strict,
30+
...configs.stylistic,
3431
{
32+
files: ['{bin,lib,lambda}/**/*.{ts,tsx}', '*.js'],
3533
plugins: {
3634
'@stylistic': stylistic,
3735
},
36+
languageOptions: {
37+
ecmaVersion: 'latest',
38+
sourceType: 'module',
39+
parser,
40+
parserOptions: {
41+
tsconfigRootDir: __dirname,
42+
project: ['./tsconfig-eslint.json'],
43+
},
44+
},
45+
extends: [
46+
eslintImport.flatConfigs.recommended,
47+
eslintImport.flatConfigs.typescript,
48+
],
49+
settings: {
50+
'import/resolver': {
51+
// You will also need to install and configure the TypeScript resolver
52+
// See also https://github.com/import-js/eslint-import-resolver-typescript#configuration
53+
'typescript': true,
54+
'node': true,
55+
},
56+
},
3857
rules: {
3958
'@stylistic/semi': ['error', 'always'],
4059
'@stylistic/indent': ['error', 2],
4160
'@stylistic/comma-dangle': ['error', 'always-multiline'],
4261
'@stylistic/quotes': ['error', 'single'],
4362
},
4463
},
45-
{
46-
files: ['{bin,lib,lambda}/**/*.{ts,tsx}'],
47-
plugins: {
48-
'@stylistic/ts': stylistic,
49-
},
50-
extends: [eslintImport.flatConfigs.recommended, eslintImport.flatConfigs.typescript],
51-
},
52-
{
53-
files: ['*.js'],
54-
plugins: {
55-
'@stylistic/js': stylistic,
56-
},
57-
},
58-
{
59-
files: ['test/**'], // or any other pattern
60-
plugins: {
61-
vitest
62-
},
63-
rules: {
64-
...vitest.configs.recommended.rules, // you can also use vitest.configs.all.rules to enable all rules
65-
'vitest/max-nested-describe': ['error', { 'max': 3 }] // you can also modify rules' behavior using option like this
66-
},
67-
},
6864
);
6965

7066
export default config;

basic/cdk/lambda/handler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import './instrumentation';
12
import { ChatPromptTemplate } from '@langchain/core/prompts';
23
import { StringOutputParser } from '@langchain/core/output_parsers';
34
import { CallbackHandler } from 'langfuse-langchain';
4-
5+
56
import { selectLlm, logger } from '@llm-ts-example/common-backend';
67

78
export async function handle(

0 commit comments

Comments
 (0)