Socket
Socket
Sign inDemoInstall

@langchain/openai

Package Overview
Dependencies
Maintainers
5
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@langchain/openai - npm Package Compare versions

Comparing version 0.0.16 to 0.0.17

7

dist/chat_models.d.ts

@@ -7,3 +7,4 @@ import { type ClientOptions, OpenAI as OpenAIClient } from "openai";

import { BaseChatModel, type BaseChatModelParams } from "@langchain/core/language_models/chat_models";
import type { BaseFunctionCallOptions, BaseLanguageModelInput, StructuredOutputMethodParams } from "@langchain/core/language_models/base";
import type { BaseFunctionCallOptions, BaseLanguageModelInput, StructuredOutputMethodOptions, StructuredOutputMethodParams } from "@langchain/core/language_models/base";
import { z } from "zod";
import { Runnable } from "@langchain/core/runnables";

@@ -145,4 +146,4 @@ import type { AzureOpenAIInput, OpenAICallOptions, OpenAIChatInput, OpenAICoreRequestOptions, LegacyOpenAIInput } from "./types.js";

_combineLLMOutput(...llmOutputs: OpenAILLMOutput[]): OpenAILLMOutput;
withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>({ schema, name, method, includeRaw, }: StructuredOutputMethodParams<RunOutput, false>): Runnable<BaseLanguageModelInput, RunOutput>;
withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>({ schema, name, method, includeRaw, }: StructuredOutputMethodParams<RunOutput, true>): Runnable<BaseLanguageModelInput, {
withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: StructuredOutputMethodParams<RunOutput, false> | z.ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(outputSchema: StructuredOutputMethodParams<RunOutput, true> | z.ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
raw: BaseMessage;

@@ -149,0 +150,0 @@ parsed: RunOutput;

@@ -717,3 +717,20 @@ import { OpenAI as OpenAIClient } from "openai";

}
withStructuredOutput({ schema, name, method, includeRaw, }) {
withStructuredOutput(outputSchema, config) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let schema;
let name;
let method;
let includeRaw;
if (isStructuredOutputMethodParams(outputSchema)) {
schema = outputSchema.schema;
name = outputSchema.name;
method = outputSchema.method;
includeRaw = outputSchema.includeRaw;
}
else {
schema = outputSchema;
name = config?.name;
method = config?.method;
includeRaw = config?.includeRaw;
}
let llm;

@@ -805,1 +822,9 @@ let outputParser;

}
function isStructuredOutputMethodParams(x
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
return (x !== undefined &&
// eslint-disable-next-line @typescript-eslint/no-explicit-any
typeof x.schema ===
"object");
}

@@ -644,4 +644,3 @@ import { test, jest, expect, describe } from "@jest/globals";

});
const modelWithStructuredOutput = model.withStructuredOutput({
schema: calculatorSchema,
const modelWithStructuredOutput = model.withStructuredOutput(calculatorSchema, {
name: "calculator",

@@ -672,4 +671,3 @@ });

});
const modelWithStructuredOutput = model.withStructuredOutput({
schema: calculatorSchema,
const modelWithStructuredOutput = model.withStructuredOutput(calculatorSchema, {
name: "calculator",

@@ -733,4 +731,3 @@ method: "jsonMode",

});
const modelWithStructuredOutput = model.withStructuredOutput({
schema: zodToJsonSchema(calculatorSchema),
const modelWithStructuredOutput = model.withStructuredOutput(zodToJsonSchema(calculatorSchema), {
name: "calculator",

@@ -767,4 +764,3 @@ method: "jsonMode",

});
const modelWithStructuredOutput = model.withStructuredOutput({
schema: calculatorSchema,
const modelWithStructuredOutput = model.withStructuredOutput(calculatorSchema, {
name: "calculator",

@@ -771,0 +767,0 @@ includeRaw: true,

{
"name": "@langchain/openai",
"version": "0.0.16",
"version": "0.0.17",
"description": "OpenAI integrations for LangChain.js",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc