diff --git a/js/packages/teams-ai/src/AI.ts b/js/packages/teams-ai/src/AI.ts index 401886b31b..7461987c3d 100644 --- a/js/packages/teams-ai/src/AI.ts +++ b/js/packages/teams-ai/src/AI.ts @@ -8,10 +8,12 @@ import { TurnContext } from 'botbuilder'; +import { TooManyStepsParameters } from './types'; + import * as actions from './actions'; import { DefaultModerator } from './moderators'; import { Moderator } from './moderators/Moderator'; -import { PredictedDoCommand, Planner, Plan } from './planners'; +import { Plan, Planner, PredictedDoCommand } from './planners'; import { TurnState } from './TurnState'; /** @@ -393,7 +395,7 @@ export class AI { // Check for timeout if (Date.now() - start_time! > max_time || ++step_count! > max_steps) { completed = false; - const parameters: actions.TooManyStepsParameters = { + const parameters: TooManyStepsParameters = { max_steps, max_time, start_time: start_time!, diff --git a/js/packages/teams-ai/src/Utilities.spec.ts b/js/packages/teams-ai/src/Utilities.spec.ts index e33b9b3812..f019d6d6d1 100644 --- a/js/packages/teams-ai/src/Utilities.spec.ts +++ b/js/packages/teams-ai/src/Utilities.spec.ts @@ -1,6 +1,6 @@ import { strict as assert } from 'assert'; -import { ClientCitation } from './actions'; +import { ClientCitation } from './types'; import { GPTTokenizer } from './tokenizers'; import { Utilities } from './Utilities'; diff --git a/js/packages/teams-ai/src/Utilities.ts b/js/packages/teams-ai/src/Utilities.ts index 0622cba83d..82c4629ff4 100644 --- a/js/packages/teams-ai/src/Utilities.ts +++ b/js/packages/teams-ai/src/Utilities.ts @@ -8,7 +8,7 @@ import { stringify } from 'yaml'; -import { ClientCitation } from './actions'; +import { ClientCitation } from './types'; import { Tokenizer } from './tokenizers'; /** diff --git a/js/packages/teams-ai/src/actions/SayCommand.ts b/js/packages/teams-ai/src/actions/SayCommand.ts index 0f9586d30b..1e03641592 100644 --- a/js/packages/teams-ai/src/actions/SayCommand.ts +++ b/js/packages/teams-ai/src/actions/SayCommand.ts @@ -6,150 +6,12 @@ * Licensed under the MIT License. */ -import { ActivityTypes, Channels, TurnContext } from 'botbuilder'; +import { Activity, ActivityTypes, Channels, TurnContext } from 'botbuilder'; import { PredictedSayCommand } from '../planners'; import { TurnState } from '../TurnState'; import { Utilities } from '../Utilities'; - -export interface AIEntity { - /** - * Required as 'https://schema.org/Message' - */ - type: 'https://schema.org/Message'; - - /** - * Required as 'Message - */ - '@type': 'Message'; - - /** - * Required as 'https://schema.org - */ - '@context': 'https://schema.org'; - - /** - * Must be left blank. This is for Bot Framework schema. - */ - '@id': ''; - - /** - * Indicate that the content was generated by AI. - */ - additionalType: ['AIGeneratedContent']; - - /** - * Optional; if citations object is included, the sent activity will include the citations, referenced in the activity text. - */ - citation?: ClientCitation[]; -} -export interface ClientCitation { - /** - * Required; must be "Claim" - */ - '@type': 'Claim'; - - /** - * Required. Number and position of the citation. - */ - position: string; - appearance: { - /** - * Required; Must be 'DigitalDocument' - */ - '@type': 'DigitalDocument'; - - /** - * Name of the document. - */ - name: string; - - /** - * Optional; ignored in Teams - */ - text?: string; - - /** - * URL of the document. This will make the name of the citation clickable and direct the user to the specified URL. - */ - url?: string; - - /** - * Content of the citation. Must be clipped if longer than 480 characters. - */ - abstract: string; - - /** - * Used for icon; for now it is ignored. - */ - encodingFormat?: 'text/html'; - - /** - * For now ignored, later used for icon - */ - image?: string; - - /** - * Optional; set by developer - */ - keywords?: string[]; - - /** - * Optional sensitivity content information. - */ - usageInfo?: SensitivityUsageInfo; - }; -} - -/** - * Sensitivity usage info for content sent to the user. This is used to provide information about the content to the user. - */ -export interface SensitivityUsageInfo { - /** - * Must be "https://schema.org/Message" - */ - type: 'https://schema.org/Message'; - - /** - * Required; Set to CreativeWork; - */ - '@type': 'CreativeWork'; - - /** - * Sensitivity description of the content - */ - description?: string; - - /** - * Sensitivity title of the content - */ - name: string; - - /** - * Optional; ignored in Teams. - */ - position?: number; - - pattern?: { - /** - * Set to DefinedTerm - */ - '@type': 'DefinedTerm'; - - inDefinedTermSet: string; - - /** - * Color - */ - name: string; - - /** - * e.g. #454545 - */ - termCode: string; - }; -} - +import { AIEntity, ClientCitation } from '../types'; /** * @private * @param {boolean} feedbackLoopEnabled - If true, the feedback loop UI for Teams will be enabled. @@ -193,21 +55,24 @@ export function sayCommand(feedbackLoopEna // If there are citations, filter out the citations unused in content. const referencedCitations = citations ? Utilities.getUsedCitations(contentText, citations) : undefined; - await context.sendActivity({ + const entities: AIEntity[] = [ + { + type: 'https://schema.org/Message', + '@type': 'Message', + '@context': 'https://schema.org', + '@id': '', + additionalType: ['AIGeneratedContent'], + ...(referencedCitations ? { citation: referencedCitations } : {}) + } + ]; + const activity: Partial = { type: ActivityTypes.Message, text: contentText, ...(isTeamsChannel ? { channelData: { feedbackLoopEnabled } } : {}), - entities: [ - { - type: 'https://schema.org/Message', - '@type': 'Message', - '@context': 'https://schema.org', - '@id': '', - additionalType: ['AIGeneratedContent'], - ...(referencedCitations ? { citation: referencedCitations } : {}) - } - ] as AIEntity[] - }); + entities: entities + }; + + await context.sendActivity(activity); return ''; }; diff --git a/js/packages/teams-ai/src/actions/TooManySteps.ts b/js/packages/teams-ai/src/actions/TooManySteps.ts index 9c1e0e6583..e6bb64d017 100644 --- a/js/packages/teams-ai/src/actions/TooManySteps.ts +++ b/js/packages/teams-ai/src/actions/TooManySteps.ts @@ -9,31 +9,7 @@ import { TurnContext } from 'botbuilder-core'; import { TurnState } from '../TurnState'; - -/** - * Parameters passed to the AI.TooManyStepsActionName action. - */ -export interface TooManyStepsParameters { - /** - * Configured maximum number of steps allowed. - */ - max_steps: number; - - /** - * Configured maximum amount of time allowed. - */ - max_time: number; - - /** - * Time the AI system started processing the current activity. - */ - start_time: number; - - /** - * Number of steps that have been executed. - */ - step_count: number; -} +import { TooManyStepsParameters } from '../types'; /** * @private diff --git a/js/packages/teams-ai/src/actions/index.ts b/js/packages/teams-ai/src/actions/index.ts index d6fef060c7..d6249809ff 100644 --- a/js/packages/teams-ai/src/actions/index.ts +++ b/js/packages/teams-ai/src/actions/index.ts @@ -7,11 +7,11 @@ */ export * from './Action'; -export * from './Unknown'; +export * from './DoCommand'; export * from './FlaggedInput'; export * from './FlaggedOutput'; export * from './HttpError'; export * from './PlanReady'; -export * from './DoCommand'; export * from './SayCommand'; export * from './TooManySteps'; +export * from './Unknown'; diff --git a/js/packages/teams-ai/src/augmentations/ActionAugmentationSection.ts b/js/packages/teams-ai/src/augmentations/ActionAugmentationSection.ts index 7abc8a0b05..657b8d15cf 100644 --- a/js/packages/teams-ai/src/augmentations/ActionAugmentationSection.ts +++ b/js/packages/teams-ai/src/augmentations/ActionAugmentationSection.ts @@ -10,8 +10,8 @@ import { TurnContext } from 'botbuilder'; import { Schema } from 'jsonschema'; import { stringify } from 'yaml'; -import { Memory } from '../MemoryFork'; import { ChatCompletionAction } from '../models'; +import { Memory } from '../MemoryFork'; import { Message, PromptFunctions, RenderedPromptSection, PromptSectionBase } from '../prompts'; import { Tokenizer } from '../tokenizers'; diff --git a/js/packages/teams-ai/src/augmentations/Augmentation.ts b/js/packages/teams-ai/src/augmentations/Augmentation.ts index f1a4ad4fe1..0c262006e5 100644 --- a/js/packages/teams-ai/src/augmentations/Augmentation.ts +++ b/js/packages/teams-ai/src/augmentations/Augmentation.ts @@ -7,11 +7,12 @@ */ import { TurnContext } from 'botbuilder-core'; -import { PromptResponseValidator } from '../validators'; -import { Plan } from '../planners'; -import { PromptSection } from '../prompts'; + import { Memory } from '../MemoryFork'; +import { Plan } from '../planners'; import { PromptResponse } from '../types'; +import { PromptResponseValidator } from '../validators'; +import { PromptSection } from '../prompts'; /** * An augmentation is a component that can be added to a prompt template to add additional diff --git a/js/packages/teams-ai/src/augmentations/DefaultAugmentation.ts b/js/packages/teams-ai/src/augmentations/DefaultAugmentation.ts index b134cc7bf0..3fb3088961 100644 --- a/js/packages/teams-ai/src/augmentations/DefaultAugmentation.ts +++ b/js/packages/teams-ai/src/augmentations/DefaultAugmentation.ts @@ -10,9 +10,9 @@ import { TurnContext } from 'botbuilder-core'; import { Memory } from '../MemoryFork'; import { Plan, PredictedSayCommand } from '../planners'; +import { PromptResponse } from '../types'; import { PromptSection } from '../prompts'; import { Tokenizer } from '../tokenizers'; -import { PromptResponse } from '../types'; import { Validation } from '../validators'; import { Augmentation } from './Augmentation'; diff --git a/js/packages/teams-ai/src/augmentations/MonologueAugmentation.ts b/js/packages/teams-ai/src/augmentations/MonologueAugmentation.ts index c503581984..83b02c090b 100644 --- a/js/packages/teams-ai/src/augmentations/MonologueAugmentation.ts +++ b/js/packages/teams-ai/src/augmentations/MonologueAugmentation.ts @@ -7,15 +7,14 @@ */ import { TurnContext } from 'botbuilder-core'; -import { Schema } from 'jsonschema'; -import { Memory } from '../MemoryFork'; +import { ActionResponseValidator, JSONResponseValidator, Validation } from '../validators'; import { ChatCompletionAction } from '../models'; +import { InnerMonologue, InnerMonologueSchema, PromptResponse } from '../types'; +import { Memory } from '../MemoryFork'; import { Message, PromptSection } from '../prompts'; -import { Tokenizer } from '../tokenizers'; -import { PromptResponse } from '../types'; import { Plan, PredictedCommand, PredictedDoCommand, PredictedSayCommand } from '../planners'; -import { ActionResponseValidator, JSONResponseValidator, Validation } from '../validators'; +import { Tokenizer } from '../tokenizers'; import { Augmentation } from './Augmentation'; import { ActionAugmentationSection } from './ActionAugmentationSection'; @@ -30,73 +29,6 @@ const MISSING_ACTION_FEEDBACK = `The JSON returned had errors. Apply these fixes */ const SAY_REDIRECT_FEEDBACK = `The JSON returned was missing an action. Return a valid JSON object that contains your thoughts and uses the SAY action.`; -/** - * Structure used to track the inner monologue of an LLM. - */ -export interface InnerMonologue { - /** - * The LLM's thoughts. - */ - thoughts: { - /** - * The LLM's current thought. - */ - thought: string; - - /** - * The LLM's reasoning for the current thought. - */ - reasoning: string; - - /** - * The LLM's plan for the future. - */ - plan: string; - }; - - /** - * The next action to perform. - */ - action: { - /** - * Name of the action to perform. - */ - name: string; - - /** - * Optional. Parameters for the action. - */ - parameters?: Record; - }; -} - -/** - * JSON schema for validating an `InnerMonologue`. - */ -export const InnerMonologueSchema: Schema = { - type: 'object', - properties: { - thoughts: { - type: 'object', - properties: { - thought: { type: 'string' }, - reasoning: { type: 'string' }, - plan: { type: 'string' } - }, - required: ['thought', 'reasoning', 'plan'] - }, - action: { - type: 'object', - properties: { - name: { type: 'string' }, - parameters: { type: 'object' } - }, - required: ['name'] - } - }, - required: ['thoughts', 'action'] -}; - /** * The 'monologue' augmentation. * @remarks diff --git a/js/packages/teams-ai/src/augmentations/SequenceAugmentation.ts b/js/packages/teams-ai/src/augmentations/SequenceAugmentation.ts index 24c5f80068..400ff50535 100644 --- a/js/packages/teams-ai/src/augmentations/SequenceAugmentation.ts +++ b/js/packages/teams-ai/src/augmentations/SequenceAugmentation.ts @@ -7,56 +7,18 @@ */ import { TurnContext } from 'botbuilder-core'; -import { Schema } from 'jsonschema'; import { Memory } from '../MemoryFork'; import { ChatCompletionAction } from '../models'; import { Plan, PredictedDoCommand, PredictedSayCommand } from '../planners'; import { Message, PromptSection } from '../prompts'; import { Tokenizer } from '../tokenizers'; -import { PromptResponse } from '../types'; +import { PlanSchema, PromptResponse } from '../types'; import { ActionResponseValidator, JSONResponseValidator, Validation } from '../validators'; import { Augmentation } from './Augmentation'; import { ActionAugmentationSection } from './ActionAugmentationSection'; -/** - * JSON schema for a `Plan`. - */ -export const PlanSchema: Schema = { - type: 'object', - properties: { - type: { - type: 'string', - enum: ['plan'] - }, - commands: { - type: 'array', - items: { - type: 'object', - properties: { - type: { - type: 'string', - enum: ['DO', 'SAY'] - }, - action: { - type: 'string' - }, - parameters: { - type: 'object' - }, - response: { - type: 'string' - } - }, - required: ['type'] - }, - minItems: 1 - } - }, - required: ['type', 'commands'] -}; - /** * The 'sequence' augmentation. * @remarks diff --git a/js/packages/teams-ai/src/embeddings/OpenAIEmbeddings.ts b/js/packages/teams-ai/src/embeddings/OpenAIEmbeddings.ts index 09800754b2..7e283aad73 100644 --- a/js/packages/teams-ai/src/embeddings/OpenAIEmbeddings.ts +++ b/js/packages/teams-ai/src/embeddings/OpenAIEmbeddings.ts @@ -7,7 +7,7 @@ */ import axios, { AxiosInstance, AxiosResponse, AxiosRequestConfig } from 'axios'; -import { EmbeddingsModel, EmbeddingsResponse } from './EmbeddingsModel'; +import { EmbeddingsModel, EmbeddingsResponse } from '../types/EmbeddingsModel'; import { CreateEmbeddingRequest, CreateEmbeddingResponse, OpenAICreateEmbeddingRequest, Colorize } from '../internals'; /** diff --git a/js/packages/teams-ai/src/embeddings/index.ts b/js/packages/teams-ai/src/embeddings/index.ts index 4786e3a81f..dea138ebe1 100644 --- a/js/packages/teams-ai/src/embeddings/index.ts +++ b/js/packages/teams-ai/src/embeddings/index.ts @@ -5,6 +5,4 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ - -export * from './EmbeddingsModel'; export * from './OpenAIEmbeddings'; diff --git a/js/packages/teams-ai/src/index.ts b/js/packages/teams-ai/src/index.ts index cff9a72bbe..2be42b06b6 100644 --- a/js/packages/teams-ai/src/index.ts +++ b/js/packages/teams-ai/src/index.ts @@ -31,10 +31,4 @@ export * from './TurnState'; export * from './Utilities'; export * from './authentication/TeamsBotSsoPrompt'; export * from './TeamsAdapter'; -export { - ActionHandler, - ClientCitation, - PredictedDoCommandAndHandler, - SensitivityUsageInfo, - TooManyStepsParameters -} from './actions'; +export { ActionHandler, PredictedDoCommandAndHandler } from './actions'; diff --git a/js/packages/teams-ai/src/internals/testing/TestEmbeddings.ts b/js/packages/teams-ai/src/internals/testing/TestEmbeddings.ts index 8f2ecbe37f..038515ed88 100644 --- a/js/packages/teams-ai/src/internals/testing/TestEmbeddings.ts +++ b/js/packages/teams-ai/src/internals/testing/TestEmbeddings.ts @@ -6,7 +6,7 @@ * Licensed under the MIT License. */ -import { EmbeddingsModel, EmbeddingsResponse, EmbeddingsResponseStatus } from '../../embeddings/EmbeddingsModel'; +import { EmbeddingsModel, EmbeddingsResponse, EmbeddingsResponseStatus } from '../../types/EmbeddingsModel'; /** * A test model that can be used to test the prompt completion system. diff --git a/js/packages/teams-ai/src/models/OpenAIModel.spec.ts b/js/packages/teams-ai/src/models/OpenAIModel.spec.ts index 3d8a57c756..3ea2a12d11 100644 --- a/js/packages/teams-ai/src/models/OpenAIModel.spec.ts +++ b/js/packages/teams-ai/src/models/OpenAIModel.spec.ts @@ -6,7 +6,9 @@ import { EventEmitter } from 'stream'; describe('OpenAIModel', () => { const GPT35_MODEL = 'gpt-3.5-turbo'; const goodEndpoint = 'https://test-endpoint.com'; - const azureADTokenProvider = async () => { return "test" }; + const azureADTokenProvider = async () => { + return 'test'; + }; it('should construct with OpenAI parameters', () => { const model = new OpenAIModel({ apiKey: 'test-api-key', diff --git a/js/packages/teams-ai/src/types/AIEntity.ts b/js/packages/teams-ai/src/types/AIEntity.ts new file mode 100644 index 0000000000..3b982635ad --- /dev/null +++ b/js/packages/teams-ai/src/types/AIEntity.ts @@ -0,0 +1,41 @@ +/** + * @module teams-ai + */ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +import { ClientCitation } from './ClientCitation'; + +export interface AIEntity { + /** + * Required as 'https://schema.org/Message' + */ + type: 'https://schema.org/Message'; + + /** + * Required as 'Message + */ + '@type': 'Message'; + + /** + * Required as 'https://schema.org + */ + '@context': 'https://schema.org'; + + /** + * Must be left blank. This is for Bot Framework schema. + */ + '@id': ''; + + /** + * Indicate that the content was generated by AI. + */ + additionalType: ['AIGeneratedContent']; + + /** + * Optional; if citations object is included, the sent activity will include the citations, referenced in the activity text. + */ + citation?: ClientCitation[]; +} diff --git a/js/packages/teams-ai/src/types/ClientCitation.ts b/js/packages/teams-ai/src/types/ClientCitation.ts new file mode 100644 index 0000000000..cea3af8357 --- /dev/null +++ b/js/packages/teams-ai/src/types/ClientCitation.ts @@ -0,0 +1,71 @@ +/** + * @module teams-ai + */ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +import { SensitivityUsageInfo } from './SensitivityUsageInfo'; + +/** + * Represents a Teams client citation to be included in a message. See Bot messages with AI-generated content for more details. + * https://learn.microsoft.com/en-us/microsoftteams/platform/bots/how-to/bot-messages-ai-generated-content?tabs=before%2Cbotmessage + */ +export interface ClientCitation { + /** + * Required; must be "Claim" + */ + '@type': 'Claim'; + + /** + * Required. Number and position of the citation. + */ + position: string; + appearance: { + /** + * Required; Must be 'DigitalDocument' + */ + '@type': 'DigitalDocument'; + + /** + * Name of the document. + */ + name: string; + + /** + * Optional; ignored in Teams + */ + text?: string; + + /** + * URL of the document. This will make the name of the citation clickable and direct the user to the specified URL. + */ + url?: string; + + /** + * Content of the citation. Must be clipped if longer than 480 characters. + */ + abstract: string; + + /** + * Used for icon; for now it is ignored. + */ + encodingFormat?: 'text/html'; + + /** + * For now ignored, later used for icon + */ + image?: string; + + /** + * Optional; set by developer + */ + keywords?: string[]; + + /** + * Optional sensitivity content information. + */ + usageInfo?: SensitivityUsageInfo; + }; +} diff --git a/js/packages/teams-ai/src/embeddings/EmbeddingsModel.ts b/js/packages/teams-ai/src/types/EmbeddingsModel.ts similarity index 100% rename from js/packages/teams-ai/src/embeddings/EmbeddingsModel.ts rename to js/packages/teams-ai/src/types/EmbeddingsModel.ts diff --git a/js/packages/teams-ai/src/types/InnerMonologue.ts b/js/packages/teams-ai/src/types/InnerMonologue.ts new file mode 100644 index 0000000000..102ef817d7 --- /dev/null +++ b/js/packages/teams-ai/src/types/InnerMonologue.ts @@ -0,0 +1,47 @@ +/** + * @module teams-ai + */ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +/** + * Structure used to track the inner monologue of an LLM. + */ +export interface InnerMonologue { + /** + * The LLM's thoughts. + */ + thoughts: { + /** + * The LLM's current thought. + */ + thought: string; + + /** + * The LLM's reasoning for the current thought. + */ + reasoning: string; + + /** + * The LLM's plan for the future. + */ + plan: string; + }; + + /** + * The next action to perform. + */ + action: { + /** + * Name of the action to perform. + */ + name: string; + + /** + * Optional. Parameters for the action. + */ + parameters?: Record; + }; +} diff --git a/js/packages/teams-ai/src/types/InnerMonologueSchema.ts b/js/packages/teams-ai/src/types/InnerMonologueSchema.ts new file mode 100644 index 0000000000..7518268f93 --- /dev/null +++ b/js/packages/teams-ai/src/types/InnerMonologueSchema.ts @@ -0,0 +1,34 @@ +/** + * @module teams-ai + */ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ +import { Schema } from 'jsonschema'; +/** + * JSON schema for validating an `InnerMonologue`. + */ +export const InnerMonologueSchema: Schema = { + type: 'object', + properties: { + thoughts: { + type: 'object', + properties: { + thought: { type: 'string' }, + reasoning: { type: 'string' }, + plan: { type: 'string' } + }, + required: ['thought', 'reasoning', 'plan'] + }, + action: { + type: 'object', + properties: { + name: { type: 'string' }, + parameters: { type: 'object' } + }, + required: ['name'] + } + }, + required: ['thoughts', 'action'] +}; diff --git a/js/packages/teams-ai/src/types/PlanSchema.ts b/js/packages/teams-ai/src/types/PlanSchema.ts new file mode 100644 index 0000000000..58eb945b07 --- /dev/null +++ b/js/packages/teams-ai/src/types/PlanSchema.ts @@ -0,0 +1,44 @@ +/** + * @module teams-ai + */ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ +import { Schema } from 'jsonschema'; +/** + * JSON schema for a `Plan`. + */ +export const PlanSchema: Schema = { + type: 'object', + properties: { + type: { + type: 'string', + enum: ['plan'] + }, + commands: { + type: 'array', + items: { + type: 'object', + properties: { + type: { + type: 'string', + enum: ['DO', 'SAY'] + }, + action: { + type: 'string' + }, + parameters: { + type: 'object' + }, + response: { + type: 'string' + } + }, + required: ['type'] + }, + minItems: 1 + } + }, + required: ['type', 'commands'] +}; diff --git a/js/packages/teams-ai/src/types/SensitivityUsageInfo.ts b/js/packages/teams-ai/src/types/SensitivityUsageInfo.ts new file mode 100644 index 0000000000..d81e5e4e33 --- /dev/null +++ b/js/packages/teams-ai/src/types/SensitivityUsageInfo.ts @@ -0,0 +1,48 @@ +/** + * Sensitivity usage info for content sent to the user. This is used to provide information about the content to the user. See ClientCitation for more information. + */ +export interface SensitivityUsageInfo { + /** + * Must be "https://schema.org/Message" + */ + type: 'https://schema.org/Message'; + + /** + * Required; Set to CreativeWork; + */ + '@type': 'CreativeWork'; + + /** + * Sensitivity description of the content + */ + description?: string; + + /** + * Sensitivity title of the content + */ + name: string; + + /** + * Optional; ignored in Teams. + */ + position?: number; + + pattern?: { + /** + * Set to DefinedTerm + */ + '@type': 'DefinedTerm'; + + inDefinedTermSet: string; + + /** + * Color + */ + name: string; + + /** + * e.g. #454545 + */ + termCode: string; + }; +} diff --git a/js/packages/teams-ai/src/types/TooManyStepsParameters.ts b/js/packages/teams-ai/src/types/TooManyStepsParameters.ts new file mode 100644 index 0000000000..9de016e8ff --- /dev/null +++ b/js/packages/teams-ai/src/types/TooManyStepsParameters.ts @@ -0,0 +1,24 @@ +/** + * Parameters passed to the AI.TooManyStepsActionName action. + */ +export interface TooManyStepsParameters { + /** + * Configured maximum number of steps allowed. + */ + max_steps: number; + + /** + * Configured maximum amount of time allowed. + */ + max_time: number; + + /** + * Time the AI system started processing the current activity. + */ + start_time: number; + + /** + * Number of steps that have been executed. + */ + step_count: number; +} diff --git a/js/packages/teams-ai/src/types/index.ts b/js/packages/teams-ai/src/types/index.ts index 376fbd858f..244834ca94 100644 --- a/js/packages/teams-ai/src/types/index.ts +++ b/js/packages/teams-ai/src/types/index.ts @@ -7,5 +7,13 @@ */ export * from './ActionCall'; +export * from './AIEntity'; +export * from './ClientCitation'; export * from './CompletionConfig'; +export * from './EmbeddingsModel'; +export * from './InnerMonologue'; +export * from './InnerMonologueSchema'; +export * from './PlanSchema'; export * from './PromptResponse'; +export * from './SensitivityUsageInfo'; +export * from './TooManyStepsParameters'; diff --git a/js/samples/04.ai-apps/a.teamsChefBot/src/index.ts b/js/samples/04.ai-apps/a.teamsChefBot/src/index.ts index effccaf43a..d6e5783c32 100644 --- a/js/samples/04.ai-apps/a.teamsChefBot/src/index.ts +++ b/js/samples/04.ai-apps/a.teamsChefBot/src/index.ts @@ -106,7 +106,7 @@ const prompts = new PromptManager({ const planner = new ActionPlanner({ model, prompts, - defaultPrompt: 'default', + defaultPrompt: 'default' }); // Define storage and application diff --git a/js/samples/04.ai-apps/i.teamsChefBot-streaming/src/index.ts b/js/samples/04.ai-apps/i.teamsChefBot-streaming/src/index.ts index 9b83259716..6c05beb2a8 100644 --- a/js/samples/04.ai-apps/i.teamsChefBot-streaming/src/index.ts +++ b/js/samples/04.ai-apps/i.teamsChefBot-streaming/src/index.ts @@ -116,14 +116,14 @@ const endStreamHandler: PromptCompletionModelResponseReceivedEvent = (ctx, memor $schema: 'http://adaptivecards.io/schemas/adaptive-card.json', version: '1.6', type: 'AdaptiveCard', - body: [ - { - type: 'TextBlock', - wrap: true, - text: streamer.getMessage(), - } - ], - }) + body: [ + { + type: 'TextBlock', + wrap: true, + text: streamer.getMessage() + } + ] + }); streamer.setAttachments([card]); };