mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(OpenAI Node): Always show jsonOutput toggle for OpenAI message operation (no-changelog) (#8651)
This commit is contained in:
parent
bd4b50cf08
commit
e9af3e754f
|
@ -6,9 +6,9 @@ import type {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
import { NodeConnectionType, updateDisplayOptions } from 'n8n-workflow';
|
import { NodeConnectionType, updateDisplayOptions } from 'n8n-workflow';
|
||||||
|
|
||||||
|
import type { Tool } from 'langchain/tools';
|
||||||
import { apiRequest } from '../../transport';
|
import { apiRequest } from '../../transport';
|
||||||
import type { ChatCompletion } from '../../helpers/interfaces';
|
import type { ChatCompletion } from '../../helpers/interfaces';
|
||||||
import type { Tool } from 'langchain/tools';
|
|
||||||
import { formatToOpenAIAssistantTool } from '../../helpers/utils';
|
import { formatToOpenAIAssistantTool } from '../../helpers/utils';
|
||||||
import { modelRLC } from '../descriptions';
|
import { modelRLC } from '../descriptions';
|
||||||
|
|
||||||
|
@ -81,13 +81,8 @@ const properties: INodeProperties[] = [
|
||||||
name: 'jsonOutput',
|
name: 'jsonOutput',
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description:
|
description:
|
||||||
'Whether to attempt to return the response in JSON format, supported by gpt-3.5-turbo-1106 and gpt-4-1106-preview',
|
'Whether to attempt to return the response in JSON format. Compatible with GPT-4 Turbo and all GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106.',
|
||||||
default: false,
|
default: false,
|
||||||
displayOptions: {
|
|
||||||
show: {
|
|
||||||
modelId: ['gpt-3.5-turbo-1106', 'gpt-4-1106-preview'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Connect your own custom n8n tools to this node on the canvas',
|
displayName: 'Connect your own custom n8n tools to this node on the canvas',
|
||||||
|
@ -212,7 +207,7 @@ export async function execute(this: IExecuteFunctions, i: number): Promise<INode
|
||||||
|
|
||||||
let toolCalls = response?.choices[0]?.message?.tool_calls;
|
let toolCalls = response?.choices[0]?.message?.tool_calls;
|
||||||
|
|
||||||
while (toolCalls && toolCalls.length) {
|
while (toolCalls?.length) {
|
||||||
messages.push(response.choices[0].message);
|
messages.push(response.choices[0].message);
|
||||||
|
|
||||||
for (const toolCall of toolCalls) {
|
for (const toolCall of toolCalls) {
|
||||||
|
|
Loading…
Reference in a new issue