Skip to content

Add ResponseFormat parameter to LangChain.Providers.OpenAI.OpenAiChatModel.GenerateAsync #510

@andreafi

Description

@andreafi

What would you like to be added:

There isn't any solution to pass ResponseFormat3 and/or JsonSerializerContext to LangChain.Providers.OpenAI.OpenAiChatModel.GenerateAsync method.

The method signature does not provide for them and ChatRequest parameter doesn't have these parameters.

You can for example add a new signature like this:

public async IAsyncEnumerable GenerateAsync(
ResponseFormat3? responseFormat, // Added
JsonSerializerContext? jsonSerializerContext, // Added
bool? strict, // Added
ChatRequest request,
ChatSettings? settings = null,
[EnumeratorCancellation] CancellationToken cancellationToken = default)

And add related code to add responseFormat when instance CreateChatCompletionRequest and to provider.Client.Chat.JsonSerializerContext in LangChain.Providers.OpenAI.OpenAiChatModel class

Thanks a lot.

Andrew

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions