mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Obs AI Assistant] Default to "native" function calling if the connector config is not exposed (#210455)
Closes https://github.com/elastic/kibana/issues/210451 ## Summary If the connector config is not exposed (e.g.: in a pre-configured connector), default to `native` function calling. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
This commit is contained in:
parent
4f5ee4ff72
commit
d36df89025
2 changed files with 11 additions and 3 deletions
|
@ -60,5 +60,13 @@ describe('isNativeFunctionCallingSupported', () => {
|
|||
});
|
||||
expect(isNativeFunctionCallingSupported(connector)).toBe(false);
|
||||
});
|
||||
|
||||
it('returns true if the config is not exposed', () => {
|
||||
const connector = createConnector({
|
||||
type: InferenceConnectorType.OpenAI,
|
||||
config: {},
|
||||
});
|
||||
expect(isNativeFunctionCallingSupported(connector)).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,9 +11,9 @@ import { OpenAiProviderType } from '../adapters/openai/types';
|
|||
export const isNativeFunctionCallingSupported = (connector: InferenceConnector): boolean => {
|
||||
switch (connector.type) {
|
||||
case InferenceConnectorType.OpenAI:
|
||||
const apiProvider =
|
||||
(connector.config.apiProvider as OpenAiProviderType) ?? OpenAiProviderType.Other;
|
||||
return apiProvider !== OpenAiProviderType.Other;
|
||||
const apiProvider = (connector.config.apiProvider as OpenAiProviderType) ?? undefined;
|
||||
// defaulting to `true` when the config is not accessible
|
||||
return apiProvider ? apiProvider !== OpenAiProviderType.Other : true;
|
||||
case InferenceConnectorType.Inference:
|
||||
// note: later we might need to check the provider type, for now let's assume support
|
||||
// will be handled by ES and that all providers will support native FC.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue