Skip to content

api_refs[minor]: Improve DX #6447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api_refs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"prettier": "^2.8.3",
"tailwindcss": "^3.3.0",
"typedoc": "^0.26.0",
"typedoc-plugin-expand-object-like-types": "^0.1.2",
"typescript": "~5.1.6"
}
}
7 changes: 5 additions & 2 deletions docs/api_refs/scripts/create-entrypoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ const BASE_TYPEDOC_CONFIG = {
"required-first",
"alphabetical",
],
plugin: ["./typedoc_plugins/hide_underscore_lc.js"],
plugin: [
"./typedoc_plugins/hide_underscore_lc.js",
"typedoc-plugin-expand-object-like-types",
],
tsconfig: "../../tsconfig.json",
readme: "none",
excludePrivate: true,
excludeInternal: true,
excludeExternals: true,
excludeExternals: false, // trying this
excludeNotDocumented: false,
includeVersion: true,
sourceLinkTemplate:
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/language_models/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ export abstract class BaseChatModel<
}
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
return {
ls_model_type: "chat",
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-anthropic/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ export class ChatAnthropicMessages<
this.streamUsage = fields?.streamUsage ?? this.streamUsage;
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
const params = this.invocationParams(options);
return {
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-aws/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ export class ChatBedrockConverse
this.guardrailConfig = rest?.guardrailConfig;
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
const params = this.invocationParams(options);
return {
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-cloudflare/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export class ChatCloudflareWorkersAI
}
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
return {
ls_provider: "cloudflare",
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-cohere/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ export class ChatCohere<
this.streamUsage = fields?.streamUsage ?? this.streamUsage;
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
const params = this.invocationParams(options);
return {
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-community/src/chat_models/bedrock/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ export class BedrockChat
};
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
const params = this.invocationParams(options);
return {
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-community/src/chat_models/fireworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export class ChatFireworks extends ChatOpenAI<ChatFireworksCallOptions> {
this.apiKey = fireworksApiKey;
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
const params = super.getLsParams(options);
params.ls_provider = "fireworks";
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-community/src/chat_models/ollama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export class ChatOllama
this.format = fields.format;
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
const params = this.invocationParams(options);
return {
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-community/src/chat_models/togetherai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export class ChatTogetherAI extends ChatOpenAI<ChatTogetherAICallOptions> {
});
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
const params = super.getLsParams(options);
params.ls_provider = "together";
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-google-common/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export abstract class ChatGoogleBase<AuthOptions>
this.buildConnection(fields ?? {}, client);
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
const params = this.invocationParams(options);
return {
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-google-genai/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ export class ChatGoogleGenerativeAI
this.streamUsage = fields?.streamUsage ?? this.streamUsage;
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
return {
ls_provider: "google_genai",
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-groq/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ export class ChatGroq extends BaseChatModel<
this.maxTokens = fields?.maxTokens;
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
const params = this.invocationParams(options);
return {
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-mistralai/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ export class ChatMistralAI<
this.streamUsage = fields?.streamUsage ?? this.streamUsage;
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
const params = this.invocationParams(options);
return {
Expand Down
1 change: 1 addition & 0 deletions libs/langchain-ollama/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ export class ChatOllama
});
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
const params = this.invocationParams(options);
return {
Expand Down
12 changes: 12 additions & 0 deletions libs/langchain-openai/src/chat_models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,17 @@ export interface ChatOpenAIFields
* console.log(message);
*
* ```
* @extends {BaseChatModel<CallOptions, AIMessageChunk>}
*
* @param {ChatOpenAICallOptions} callOptions - The call options for the ChatOpenAI instance
* @param {ChatOpenAIToolType[]} [callOptions.tools] - The tools to use with the model
* @param {OpenAIToolChoice} [callOptions.tool_choice] - The tool choice configuration
* @param {number} [callOptions.promptIndex] - The index of the prompt to use
* @param {{ type: "json_object" }} [callOptions.response_format] - The format of the response
* @param {number} [callOptions.seed] - The seed for random number generation
* @param {{ include_usage: boolean }} [callOptions.stream_options] - Options for streamed completions
* @param {boolean} [callOptions.parallel_tool_calls] - Whether to allow parallel tool calls
* @param {boolean} [callOptions.strict] - Whether to use strict mode for JSON schema validation
*/
export class ChatOpenAI<
CallOptions extends ChatOpenAICallOptions = ChatOpenAICallOptions
Expand Down Expand Up @@ -616,6 +627,7 @@ export class ChatOpenAI<
}
}

/** @ignore */
getLsParams(options: this["ParsedCallOptions"]): LangSmithParams {
const params = this.invocationParams(options);
return {
Expand Down
5 changes: 5 additions & 0 deletions libs/langchain-openai/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ export type OpenAICoreRequestOptions<
idempotencyKey?: string;
};

/**
* @typedef {Object} OpenAICallOptions
* @extends BaseLanguageModelCallOptions
* @property {OpenAICoreRequestOptions} [options] - Additional options to pass to the underlying axios request.
*/
export interface OpenAICallOptions extends BaseLanguageModelCallOptions {
/**
* Additional options to pass to the underlying axios request.
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20250,6 +20250,7 @@ __metadata:
react-dom: ^18
tailwindcss: ^3.3.0
typedoc: ^0.26.0
typedoc-plugin-expand-object-like-types: ^0.1.2
typescript: ~5.1.6
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -39863,6 +39864,15 @@ __metadata:
languageName: node
linkType: hard

"typedoc-plugin-expand-object-like-types@npm:^0.1.2":
version: 0.1.2
resolution: "typedoc-plugin-expand-object-like-types@npm:0.1.2"
peerDependencies:
typedoc: 0.22.x || 0.23.x
checksum: 9dd58ce283386709c821f7a30267edddff984cac69fc8dc994185378403d586ac53a58b790b553693a572ea5d417e5a9bb90c02d4e73dbf595ec5a3156b5252e
languageName: node
linkType: hard

"typedoc-plugin-markdown@npm:4.0.0-next.6":
version: 4.0.0-next.6
resolution: "typedoc-plugin-markdown@npm:4.0.0-next.6"
Expand Down
Loading