Skip to content

Commit

Permalink
Move function naming to American English (#165561)
Browse files Browse the repository at this point in the history
  • Loading branch information
CoenWarmer authored Sep 4, 2023
1 parent 9d74315 commit bc2146c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions x-pack/plugins/observability_ai_assistant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ The knowledge base is an Elasticsearch index, with an inference processor powere

Both the user and the LLM are able to suggest functions, that are executed on behalf (and with the privileges of) the user. Functions allow both the user and the LLM to include relevant context into the conversation. This context can be text, data, or a visual component, like a timeseries graph. Some of the functions that are available are:

- `recall` and `summarise`: these functions query (with a semantic search) or write to (with a summarisation) the knowledge database. This allows the LLM to create a (partly) user-specific working memory, and access predefined embeddings that help improve its understanding of the Elastic platform.
- `lens`: a function that can be used to create Lens visualisations using Formulas.
- `recall` and `summarize`: these functions query (with a semantic search) or write to (with a summarisation) the knowledge database. This allows the LLM to create a (partly) user-specific working memory, and access predefined embeddings that help improve its understanding of the Elastic platform.
- `lens`: a function that can be used to create Lens vizualisations using Formulas.
- `get_apm_timeseries`, `get_apm_service_summary`, `get_apm_downstream_dependencies` and `get_apm_error_document`: a set of APM functions, some with visual components, that are helpful in performing root cause analysis.

Function calling is completely transparent to the user - they can edit function suggestions from the LLM, or inspect a function response (but not edit it), or they can request a function themselves.
Function calling is completely transparent to the user - they can edit function suggestions from the LLM, or inspect a function response (but not edit it), or they can request a function themselves.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { registerElasticsearchFunction } from './elasticsearch';
import { registerKibanaFunction } from './kibana';
import { registerLensFunction } from './lens';
import { registerRecallFunction } from './recall';
import { registerSummarisationFunction } from './summarise';
import { registerSummarizationFunction } from './summarize';
import { registerAlertsFunction } from './alerts';

export async function registerFunctions({
Expand Down Expand Up @@ -53,7 +53,7 @@ export async function registerFunctions({
);

if (isReady) {
description += `You can use the "summarise" functions to store new information you have learned in a knowledge database. Once you have established that you did not know the answer to a question, and the user gave you this information, it's important that you create a summarisation of what you have learned and store it in the knowledge database.
description += `You can use the "summarize" functions to store new information you have learned in a knowledge database. Once you have established that you did not know the answer to a question, and the user gave you this information, it's important that you create a summarisation of what you have learned and store it in the knowledge database.
Additionally, you can use the "recall" function to retrieve relevant information from the knowledge database.
`;
Expand All @@ -64,9 +64,9 @@ export async function registerFunctions({
- ALWAYS query the knowledge base, using the recall function, when a user starts a chat, no matter how confident you are in your ability to answer the question.
- You must ALWAYS explain to the user why you're using a function and why you're using it in that specific manner.
- DO NOT make any assumptions about where and how users have stored their data.
- ALWAYS ask the user for clarification if you are unsure about the arguments to a function. When given this clarification, you MUST use the summarise function to store what you have learned.
- ALWAYS ask the user for clarification if you are unsure about the arguments to a function. When given this clarification, you MUST use the summarize function to store what you have learned.
`;
registerSummarisationFunction({ service, registerFunction });
registerSummarizationFunction({ service, registerFunction });
registerRecallFunction({ service, registerFunction });
registerLensFunction({ service, pluginsStart, registerFunction });
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ export function registerLensFunction({
name: 'lens',
contexts: ['core'],
description:
"Use this function to create custom visualisations, using Lens, that can be saved to dashboards. When using this function, make sure to use the recall function to get more information about how to use it, with how you want to use it. Make sure the query also contains information about the user's request. The visualisation is displayed to the user above your reply, DO NOT try to generate or display an image yourself.",
"Use this function to create custom visualizations, using Lens, that can be saved to dashboards. When using this function, make sure to use the recall function to get more information about how to use it, with how you want to use it. Make sure the query also contains information about the user's request. The visualisation is displayed to the user above your reply, DO NOT try to generate or display an image yourself.",
descriptionForUser:
'Use this function to create custom visualisations, using Lens, that can be saved to dashboards.',
'Use this function to create custom visualizations, using Lens, that can be saved to dashboards.',
parameters: {
type: 'object',
additionalProperties: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function registerRecallFunction({
{
name: 'recall',
contexts: ['core'],
description: `Use this function to recall earlier learnings. Anything you will summarise can be retrieved again later via this function. This is semantic/vector search so there's no need for an exact match.
description: `Use this function to recall earlier learnings. Anything you will summarize can be retrieved again later via this function. This is semantic/vector search so there's no need for an exact match.
Make sure the query covers the following aspects:
- The user's prompt, verbatim
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import type { RegisterFunctionDefinition } from '../../common/types';
import type { ObservabilityAIAssistantService } from '../types';

export function registerSummarisationFunction({
export function registerSummarizationFunction({
service,
registerFunction,
}: {
Expand All @@ -17,12 +17,12 @@ export function registerSummarisationFunction({
}) {
registerFunction(
{
name: 'summarise',
name: 'summarize',
contexts: ['core'],
description:
"Use this function to summarise things learned from the conversation. You can score the learnings with a confidence metric, whether it is a correction on a previous learning. An embedding will be created that you can recall later with a semantic search. There is no need to ask the user for permission to store something you have learned, unless you do not feel confident. When you create this summarisation, make sure you craft it in a way that can be recalled with a semantic search later, and that it would have answered the user's original request.",
"Use this function to summarize things learned from the conversation. You can score the learnings with a confidence metric, whether it is a correction on a previous learning. An embedding will be created that you can recall later with a semantic search. There is no need to ask the user for permission to store something you have learned, unless you do not feel confident. When you create this summarisation, make sure you craft it in a way that can be recalled with a semantic search later, and that it would have answered the user's original request.",
descriptionForUser:
'This function allows the Elastic Assistant to summarise things from the conversation.',
'This function allows the Elastic Assistant to summarize things from the conversation.',
parameters: {
type: 'object',
additionalProperties: false,
Expand Down Expand Up @@ -66,7 +66,7 @@ export function registerSummarisationFunction({
signal
) => {
return service
.callApi('POST /internal/observability_ai_assistant/functions/summarise', {
.callApi('POST /internal/observability_ai_assistant/functions/summarize', {
params: {
body: {
id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const functionRecallRoute = createObservabilityAIAssistantServerRoute({
});

const functionSummariseRoute = createObservabilityAIAssistantServerRoute({
endpoint: 'POST /internal/observability_ai_assistant/functions/summarise',
endpoint: 'POST /internal/observability_ai_assistant/functions/summarize',
params: t.type({
body: t.type({
id: t.string,
Expand Down Expand Up @@ -208,7 +208,7 @@ const functionSummariseRoute = createObservabilityAIAssistantServerRoute({
labels,
} = resources.params.body;

return client.summarise({
return client.summarize({
entry: {
confidence,
id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,12 @@ export class ObservabilityAIAssistantClient {
});
};

summarise = async ({
summarize = async ({
entry,
}: {
entry: Omit<KnowledgeBaseEntry, '@timestamp'>;
}): Promise<void> => {
return this.dependencies.knowledgeBaseService.summarise({
return this.dependencies.knowledgeBaseService.summarize({
namespace: this.dependencies.namespace,
user: this.dependencies.user,
entry,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class KnowledgeBaseService {
return;
}

await this.summarise({
await this.summarize({
entry: operation.document,
});
}
Expand Down Expand Up @@ -223,7 +223,7 @@ export class KnowledgeBaseService {
}
};

summarise = async ({
summarize = async ({
entry: { id, ...document },
user,
namespace,
Expand Down

0 comments on commit bc2146c

Please sign in to comment.