Skip to content

Commit b5de9a6

Browse files
authored
standard-tests[major], openai[minor]: Init package & add standard tests to openai (#5612)
* standard-tests[major]: Init package * fix build, cleanup * base class and unit tests * format n lint * updates * Added standard unit tests to oai and scripts, made getLsParams public * yarn install * always include api key * set env var instead of constructor args * added integration tests * add int tests to openai * add wso tests * Add to root & turbo, added gh action * usage metadata tests for streaming and invoke * Added call options arg to integration tests * tmp run standard test action in pr ci * remove from pr ci * test moar things, add readme * chore: lint files * token usage standard tests non streaming
1 parent 156695c commit b5de9a6

File tree

36 files changed

+1223
-23
lines changed

36 files changed

+1223
-23
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Standard Tests (Integration)
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 13 * * *'
7+
8+
jobs:
9+
openai:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Use Node.js 18.x
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: 18.x
17+
cache: "yarn"
18+
- name: Install dependencies
19+
run: yarn install --immutable --mode=skip-build
20+
- name: Run standard tests (integration)
21+
run: yarn test:standard:int --filter=@langchain/openai
22+
env:
23+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

‎langchain-core/src/language_models/chat_models.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export abstract class BaseChatModel<
263263
}
264264
}
265265

266-
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
266+
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
267267
return {
268268
ls_model_type: "chat",
269269
ls_stop: options.stop,

‎libs/langchain-anthropic/src/chat_models.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ export class ChatAnthropicMessages<
518518
this.clientOptions = fields?.clientOptions ?? {};
519519
}
520520

521-
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
521+
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
522522
const params = this.invocationParams(options);
523523
return {
524524
ls_provider: "openai",

‎libs/langchain-cohere/src/chat_models.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class ChatCohere<
146146
this.streaming = fields?.streaming ?? this.streaming;
147147
}
148148

149-
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
149+
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
150150
const params = this.invocationParams(options);
151151
return {
152152
ls_provider: "cohere",

‎libs/langchain-community/src/chat_models/fireworks.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class ChatFireworks extends ChatOpenAI<ChatFireworksCallOptions> {
104104
this.apiKey = fireworksApiKey;
105105
}
106106

107-
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
107+
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
108108
const params = super.getLsParams(options);
109109
params.ls_provider = "fireworks";
110110
return params;

‎libs/langchain-community/src/chat_models/ollama.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export class ChatOllama
177177
this.format = fields.format;
178178
}
179179

180-
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
180+
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
181181
const params = this.invocationParams(options);
182182
return {
183183
ls_provider: "ollama",

‎libs/langchain-community/src/chat_models/togetherai.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class ChatTogetherAI extends ChatOpenAI<ChatTogetherAICallOptions> {
116116
});
117117
}
118118

119-
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
119+
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
120120
const params = super.getLsParams(options);
121121
params.ls_provider = "together";
122122
return params;

‎libs/langchain-google-common/src/chat_models.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export abstract class ChatGoogleBase<AuthOptions>
231231
this.buildConnection(fields ?? {}, client);
232232
}
233233

234-
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
234+
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
235235
const params = this.invocationParams(options);
236236
return {
237237
ls_provider: "google_vertexai",

‎libs/langchain-google-genai/src/chat_models.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export class ChatGoogleGenerativeAI
308308
);
309309
}
310310

311-
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
311+
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
312312
return {
313313
ls_provider: "google_genai",
314314
ls_model_name: this.model,

‎libs/langchain-mistralai/src/chat_models.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ export class ChatMistralAI<
409409
this.model = this.modelName;
410410
}
411411

412-
protected getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
412+
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
413413
const params = this.invocationParams(options);
414414
return {
415415
ls_provider: "mistral",

0 commit comments

Comments
 (0)