Skip to content

Commit

Permalink
fix(chat-models): Fix ChatOpenAI not considering functions from defau…
Browse files Browse the repository at this point in the history
…lt options (#257)
  • Loading branch information
davidmigloz authored Dec 11, 2023
1 parent 8315474 commit cd86478
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/langchain_openai/lib/src/chat_models/openai.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,11 @@ class ChatOpenAI extends BaseChatModel<ChatOpenAIOptions> {
final ChatOpenAIOptions? options,
}) {
final messagesDtos = messages.toChatCompletionMessages();
final functionsDtos = options?.functions?.toFunctionObjects();
final functionCall = options?.functionCall?.toChatCompletionFunctionCall();
final functionsDtos = options?.functions?.toFunctionObjects() ??
defaultOptions.functions?.toFunctionObjects();
final functionCall =
options?.functionCall?.toChatCompletionFunctionCall() ??
defaultOptions.functionCall?.toChatCompletionFunctionCall();
final responseFormat =
options?.responseFormat ?? defaultOptions.responseFormat;
final responseFormatDto = responseFormat?.toChatCompletionResponseFormat();
Expand Down

0 comments on commit cd86478

Please sign in to comment.