mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
# Backport This will backport the following commits from `main` to `8.14`: - [[Obs AI Assistant] Make sure arguments have a default (#185691)](https://github.com/elastic/kibana/pull/185691) <!--- Backport version: 7.3.2 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT {commits} BACKPORT--> Co-authored-by: Sandra G <neptunian@users.noreply.github.com>
This commit is contained in:
parent
a3a1efbb01
commit
669df43b88
1 changed files with 7 additions and 4 deletions
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { encode } from 'gpt-tokenizer';
|
||||
import { compact, isEmpty, merge, omit, pick } from 'lodash';
|
||||
import { compact, merge, pick } from 'lodash';
|
||||
import OpenAI from 'openai';
|
||||
import { identity } from 'rxjs';
|
||||
import { CompatibleJSONSchema } from '../../../../common/functions/types';
|
||||
|
@ -68,9 +68,12 @@ function messagesToOpenAI(messages: Message[]): OpenAI.ChatCompletionMessagePara
|
|||
return {
|
||||
role,
|
||||
content: message.message.content,
|
||||
function_call: isEmpty(message.message.function_call?.name)
|
||||
? undefined
|
||||
: omit(message.message.function_call, 'trigger'),
|
||||
function_call: message.message.function_call?.name
|
||||
? {
|
||||
name: message.message.function_call.name,
|
||||
arguments: message.message.function_call?.arguments || '{}',
|
||||
}
|
||||
: undefined,
|
||||
name: message.message.name,
|
||||
} as OpenAI.ChatCompletionMessageParam;
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue