@worktango/ai-assistant 0.0.1 → 0.0.2-beta-gd1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -6
- package/backendTypes.ts +268 -0
- package/constants.js +80 -0
- package/dist/Absenteeism-CuAiko3K.mjs +49 -0
- package/dist/ActivityFeed-B5X9Mfzs.mjs +41 -0
- package/dist/AddUser-BubC1Bl4.mjs +128 -0
- package/dist/Admin-Bmgrl4WC.mjs +55 -0
- package/dist/Admin-DqXQsgLG.mjs +70 -0
- package/dist/AiGeneral-BsRIX0CM.mjs +43 -0
- package/dist/AiScoring-H0QPuaNp.mjs +67 -0
- package/dist/AiText-C2qpOSbA.mjs +67 -0
- package/dist/Anniversary-qS0JDQno.mjs +35 -0
- package/dist/Appreciation-BMIRAaKV.mjs +55 -0
- package/dist/ArrowDown-Cir_11Ww.mjs +38 -0
- package/dist/ArrowLeft-BAqK-dnx.mjs +12 -0
- package/dist/ArrowRight-BPwQdxlE.mjs +12 -0
- package/dist/ArrowUp-DSYPXtix.mjs +31 -0
- package/dist/Attachment-D_89MWP-.mjs +20 -0
- package/dist/BeQuickDontHurry-Sdm5xWSX.mjs +94 -0
- package/dist/Birthday-Cmij06yx.mjs +66 -0
- package/dist/BrandPromise-CX53V3fL.mjs +57 -0
- package/dist/BrandVision-DbY0Rl5r.mjs +96 -0
- package/dist/Calendar-B9Poro9L.mjs +24 -0
- package/dist/CaretDn-DjPWxbY8.mjs +11 -0
- package/dist/CaretDown-DeKyH9kO.mjs +5 -0
- package/dist/CaretLeft-B113ZU-j.mjs +11 -0
- package/dist/CaretRight-DM-6XyZF.mjs +11 -0
- package/dist/CaretUp-CYuaI2Bm.mjs +11 -0
- package/dist/ChallengeAccepted-1cTHTPo0.mjs +49 -0
- package/dist/CheckIn-3Nfsk5oT.mjs +34 -0
- package/dist/CheckIns-BLgmmnox.mjs +33 -0
- package/dist/CheckSeal-BphC125F.mjs +31 -0
- package/dist/Checkmark-DKHU3qCJ.mjs +16 -0
- package/dist/Clock-NbUQnxYW.mjs +33 -0
- package/dist/Close-BscvWpF4.mjs +12 -0
- package/dist/CloudDownload-DkQrhuWv.mjs +40 -0
- package/dist/Comment-CZk5Lk7d.mjs +167 -0
- package/dist/Comments-D-Lz0XLl.mjs +48 -0
- package/dist/Connections-BEoj8G_O.mjs +49 -0
- package/dist/Copy-B3pKItuB.mjs +72 -0
- package/dist/CustomQuestion-D5WtxIAe.mjs +40 -0
- package/dist/CustomerSuccess-Ctg9iAvH.mjs +50 -0
- package/dist/DatePicker-BgYtdpM6.mjs +303 -0
- package/dist/Dot-C12qCBJh.mjs +12 -0
- package/dist/Download-Bi7AwcX_.mjs +38 -0
- package/dist/Drag-D8uEUuyy.mjs +41 -0
- package/dist/DragIndicator-vsZFDT1S.mjs +12 -0
- package/dist/Earn-eoNxiFKF.mjs +15 -0
- package/dist/Email-CfdtKKpS.mjs +24 -0
- package/dist/EmojiDisplay-DWeK3eWd.mjs +38975 -0
- package/dist/EmojiPicker-BoDN-GVX.mjs +29560 -0
- package/dist/EnpsSurvey-1povxvGk.mjs +49 -0
- package/dist/Expired-kwpsq7dE.mjs +33 -0
- package/dist/Eye-B6z0dzgP.mjs +27 -0
- package/dist/Feedback-CV-T1EA3.mjs +41 -0
- package/dist/Feedback-Cb7jIXSH.mjs +49 -0
- package/dist/Filter-8sxkwh1N.mjs +64 -0
- package/dist/Flag-CntrQmRY.mjs +35 -0
- package/dist/Giphy-MaNHdkAv.mjs +22 -0
- package/dist/GoalCount-BY154kkv.mjs +10 -0
- package/dist/GoalPercent-BRzZG4Xj.mjs +21 -0
- package/dist/GoalTask-Bbdxra-C.mjs +20 -0
- package/dist/GoalTask-CQQziW53.mjs +42 -0
- package/dist/Goals-HmCYQeMJ.mjs +70 -0
- package/dist/Goals-Q3pIFD6u.mjs +79 -0
- package/dist/Growth-DE39Oniv.mjs +85 -0
- package/dist/Hamburger-BHn5s95p.mjs +9 -0
- package/dist/Help-BcQQwdw7.mjs +36 -0
- package/dist/HighFive-D8PsCd5X.mjs +38 -0
- package/dist/HighFive-D_D4cpVC.mjs +33 -0
- package/dist/Home-CI5tkvjJ.mjs +21 -0
- package/dist/Home-toyH6nRq.mjs +31 -0
- package/dist/HorizontalLine-DB7rYyci.mjs +17 -0
- package/dist/Hourglass-DxYMZPi1.mjs +53 -0
- package/dist/Image-ConUoLpH.mjs +41 -0
- package/dist/ImageFile-Bz7J0mt7.mjs +60 -0
- package/dist/InGoodCompany-DxXMCXkz.mjs +33 -0
- package/dist/Incentives-DSX-kHnf.mjs +155 -0
- package/dist/Info-BVCb--pE.mjs +31 -0
- package/dist/Insights-DGtpV7vl.mjs +41 -0
- package/dist/Insights-DHqGpH01.mjs +20 -0
- package/dist/Integrations-Ba3Lo9gy.mjs +33 -0
- package/dist/KazooLogo-BT7YZMt2.mjs +38 -0
- package/dist/KnowYourAudience-B_RlVbB2.mjs +91 -0
- package/dist/Launch-DyQpuj07.mjs +83 -0
- package/dist/Link-BLWdkQvZ.mjs +43 -0
- package/dist/LinkArrow-CE3JoMD9.mjs +12 -0
- package/dist/Loading-CfksjkIK.mjs +6 -0
- package/dist/Lock-Do1k-9WN.mjs +31 -0
- package/dist/Management-CBYOk7gX.mjs +87 -0
- package/dist/MeatballMenu-B4pnE2jx.mjs +9 -0
- package/dist/MediaError-C5NtgYKI.mjs +40 -0
- package/dist/Messages-D9xpFBa2.mjs +221 -0
- package/dist/Microphone-BxKhLspD.mjs +63 -0
- package/dist/Mobile-B27QajLf.mjs +31 -0
- package/dist/Nomination-pSgVJG6H.mjs +12 -0
- package/dist/NominationsAndAwards-FjoFycwm.mjs +57 -0
- package/dist/Notification-DTKKHOUU.mjs +28 -0
- package/dist/Okrs-Cx3DS3C9.mjs +55 -0
- package/dist/Pause-B5sFk5Rh.mjs +12 -0
- package/dist/PeerToPeer-QPdnKvGn.mjs +64 -0
- package/dist/Pencil-BbmC1cJS.mjs +25 -0
- package/dist/People-BxnU8Z05.mjs +43 -0
- package/dist/PerformanceManagement-BLZfPkTX.mjs +57 -0
- package/dist/Pin-DeOFNuHd.mjs +24 -0
- package/dist/PinnedIconAward-BxgSnJf_.mjs +20 -0
- package/dist/PinnedIconBrightIdea-BPkLUs1e.mjs +20 -0
- package/dist/PinnedIconBullseye-DxfWzALv.mjs +36 -0
- package/dist/PinnedIconChampagne-BajLXSTD.mjs +20 -0
- package/dist/PinnedIconCheer-CDXwPi5_.mjs +20 -0
- package/dist/PinnedIconCrown-DW0xXG6F.mjs +20 -0
- package/dist/PinnedIconDiamond-BBexCsja.mjs +20 -0
- package/dist/PinnedIconHoleInOne-Bvd8LwZd.mjs +20 -0
- package/dist/PinnedIconMedal-CNwdAQ6f.mjs +20 -0
- package/dist/PinnedIconMetrics-BGrgQYes.mjs +20 -0
- package/dist/PinnedIconPin-C5rf2L5-.mjs +20 -0
- package/dist/PinnedIconRockAndRoll-BJr0GFBC.mjs +23 -0
- package/dist/PinnedIconRocket-D-mWFglo.mjs +20 -0
- package/dist/PinnedIconStrength-C65sHChH.mjs +20 -0
- package/dist/PinnedIconTeddyBear-Dx6rjj0F.mjs +20 -0
- package/dist/PlatformLogo-C8jT1pTg.mjs +57 -0
- package/dist/Plus-yM1jlKOj.mjs +19 -0
- package/dist/Popper-BVVjK1ai.mjs +1118 -0
- package/dist/PrivateEye-CkBX7r_4.mjs +127 -0
- package/dist/PrivatePushPin-Bp_WTQS6.mjs +33 -0
- package/dist/Processing-CNd1Y61-.mjs +80 -0
- package/dist/Productivity-CSFF_TTn.mjs +41 -0
- package/dist/ProgressCircle-CLSKP2Gl.mjs +12 -0
- package/dist/PulseSurvey-CsL6WZdI.mjs +48 -0
- package/dist/PushPin-Bu-auPnk.mjs +18 -0
- package/dist/QuotesLeft-BWpNDBal.mjs +18 -0
- package/dist/QuotesRight-BpBh5mG9.mjs +18 -0
- package/dist/Recognition-4MknR18w.mjs +76 -0
- package/dist/Recognition-BI46J6ho.mjs +38 -0
- package/dist/Retention-HYeKh30a.mjs +47 -0
- package/dist/Rewards-C1aRZ0ot.mjs +54 -0
- package/dist/Rewards-U4ogz8U4.mjs +67 -0
- package/dist/RewardsCatalog-gfuBQBZf.mjs +49 -0
- package/dist/Roadmap-BlWzZybo.mjs +122 -0
- package/dist/Search-CJKwg6fG.mjs +14 -0
- package/dist/Security-DG-tKQmP.mjs +33 -0
- package/dist/SendRecognition-DYsixh4T.mjs +5 -0
- package/dist/ShareLink-Guocx8fQ.mjs +27 -0
- package/dist/SidebarCollapse-BeAh_fr2.mjs +48 -0
- package/dist/Skill-0jXs--Pa.mjs +23 -0
- package/dist/Skills--kXnMP25.mjs +68 -0
- package/dist/Smiley-Cby6kWK-.mjs +84 -0
- package/dist/Stop-Dsa1AnGS.mjs +178 -0
- package/dist/Survey-Cizp4n_t.mjs +59 -0
- package/dist/Surveys-Cu1FymdO.mjs +54 -0
- package/dist/SyncUps-D804GfQz.mjs +30 -0
- package/dist/Syncs-DQ-919jk.mjs +29 -0
- package/dist/TalentReview-CiuvS5J3.mjs +88 -0
- package/dist/TalentReview-f8Q0mOBN.mjs +33 -0
- package/dist/TalentReviewInsights-DgBVuH3k.mjs +100 -0
- package/dist/TaskCompleted-D5rrMYYp.mjs +97 -0
- package/dist/Team-BncNuLPP.mjs +63 -0
- package/dist/Teams-BRogz9Tn.mjs +80 -0
- package/dist/TextBold-DJ5W6YOb.mjs +71 -0
- package/dist/TextBulletList-g-kVni4u.mjs +128 -0
- package/dist/TextInput-CzbxrQQV.mjs +121 -0
- package/dist/TextItalic-Bx9VLcRy.mjs +71 -0
- package/dist/TextNumberList-BbbGvl-u.mjs +147 -0
- package/dist/TextUnderline-CQkl5YOg.mjs +90 -0
- package/dist/ThumbsDown-Dc1PkDCJ.mjs +46 -0
- package/dist/ThumbsUp-Bgu_lYD4.mjs +46 -0
- package/dist/Toggle-BXUhrGpw.mjs +76 -0
- package/dist/Translate-Bi7IGF68.mjs +98 -0
- package/dist/Trash-DWu72EZ6.mjs +44 -0
- package/dist/TrendDown-BC-9pZum.mjs +5 -0
- package/dist/TrendUp-Dz-IKKdW.mjs +5 -0
- package/dist/Undo-CmGObnDk.mjs +41 -0
- package/dist/Unplugged-Be-cdep6.mjs +201 -0
- package/dist/UpDownCaret-BvKpox10.mjs +12 -0
- package/dist/VerifiedCheckmark-DKolIbtV.mjs +20 -0
- package/dist/VerticalLine-BivXZNlq.mjs +50 -0
- package/dist/Warning-BarF7LSj.mjs +37 -0
- package/dist/WarningNoOutline-DWSpFbfu.mjs +41 -0
- package/dist/YesAnd-C4WGIC0q.mjs +31 -0
- package/dist/ai-assistant.css +1 -0
- package/dist/emoji-CQ3lkPBy.mjs +2310 -0
- package/dist/express.js +11889 -0
- package/dist/html2canvas.esm-DgdJBc_o.mjs +4871 -0
- package/dist/index-BEKNcH9V.mjs +721 -0
- package/dist/react-apexcharts.min-B2cJmFLN.mjs +11326 -0
- package/dist/react.js +15 -0
- package/dist/react.umd.js +1691 -0
- package/dist/reactComponent-2MdwkH_N.mjs +43968 -0
- package/express.d.ts +88 -1
- package/generated/apiHooks.tsx +5644 -0
- package/generated/sdk.ts +5119 -0
- package/generated/stitchedSdk.ts +1174 -0
- package/package.json +46 -21
- package/react.d.ts +215 -0
- package/sharedTypes.ts +386 -0
- package/express.js +0 -1
- package/react.js +0 -1
package/package.json
CHANGED
|
@@ -1,38 +1,63 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@worktango/ai-assistant",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"main": "dist/ai-assistant.umd.js",
|
|
5
|
-
"module": "dist/ai-assistant.es.js",
|
|
6
|
-
"types": "react.d.ts",
|
|
3
|
+
"version": "0.0.2-beta-gd1",
|
|
7
4
|
"files": [
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
5
|
+
"backendTypes.ts",
|
|
6
|
+
"constants.js",
|
|
7
|
+
"dist",
|
|
8
|
+
"express.d.ts",
|
|
11
9
|
"express.js",
|
|
12
|
-
"
|
|
10
|
+
"generated",
|
|
11
|
+
"react.d.ts",
|
|
12
|
+
"react.js",
|
|
13
|
+
"sharedTypes.ts"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
15
|
-
"checkIfPublishable": "git status --porcelain | grep . && echo 'Dirty tree. Aborting.' && exit 1 || exit 0",
|
|
16
16
|
"dev": "vite --config vite.config.ts src/dev",
|
|
17
17
|
"dev:backend": "nodemon express.js",
|
|
18
|
-
"build:backend": "esbuild src/backend/express.ts --bundle --platform=node --outfile=dist/express.js \"--external
|
|
18
|
+
"build:backend": "esbuild src/backend/express.ts --bundle --platform=node --outfile=dist/express.js \"--external:express\"",
|
|
19
19
|
"build:frontend": "vite build",
|
|
20
|
-
"build": "yarn build:backend && yarn build:frontend && yarn ts-node -T scripts/
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
20
|
+
"build:all": "rm -rf dist && yarn build:backend && yarn build:frontend && yarn ts-node -T scripts/injectCssIntoBuild.ts",
|
|
21
|
+
"prepareBuildForPublish": "yarn ts-node -T scripts/prepareBuildForPublish.ts",
|
|
22
|
+
"publish": "yarn build:all && yarn prepareBuildForPublish && yarn actuallyPublishPackage",
|
|
23
|
+
"actuallyPublishPackage": "yarn npm publish --access public --tolerate-republish --tag beta",
|
|
24
|
+
"gql:generate": "gql-generate",
|
|
25
|
+
"link:pulse-web": "bash scripts/linkToPulseWeb.sh"
|
|
24
26
|
},
|
|
25
27
|
"dependencies": {
|
|
26
|
-
"
|
|
27
|
-
"react": "
|
|
28
|
+
"@apollo/client": "^3.0.0",
|
|
29
|
+
"@ricky0123/vad-react": "^0.0.28",
|
|
30
|
+
"@sinclair/typebox": "^0.34",
|
|
31
|
+
"apexcharts": "^4.7.0",
|
|
32
|
+
"classnames": "^2.2.6",
|
|
33
|
+
"dom-to-semantic-markdown": "^1.3",
|
|
34
|
+
"html2canvas": "^1.4.1",
|
|
35
|
+
"http-proxy-middleware": "^3",
|
|
36
|
+
"json-nd": "^1",
|
|
37
|
+
"lodash.clonedeep": "^4",
|
|
38
|
+
"micromark": "^4",
|
|
39
|
+
"micromark-extension-gfm-table": "^2.1.1",
|
|
40
|
+
"react-apexcharts": "^1.7.0",
|
|
41
|
+
"uuid": "^9"
|
|
28
42
|
},
|
|
29
43
|
"devDependencies": {
|
|
30
|
-
"@types/react": "^18",
|
|
31
44
|
"@vitejs/plugin-react": "^4.2.1",
|
|
32
45
|
"esbuild": "^0.17.11",
|
|
33
|
-
"ts-node": "^10.9.
|
|
34
|
-
"typescript": "~5.
|
|
35
|
-
"vite": "~6.
|
|
36
|
-
|
|
46
|
+
"ts-node": "^10.9.2",
|
|
47
|
+
"typescript": "~5.8",
|
|
48
|
+
"vite": "~6.3.5"
|
|
49
|
+
},
|
|
50
|
+
"graphqlCodeGeneration": {
|
|
51
|
+
"apiHooks": {
|
|
52
|
+
"config": {
|
|
53
|
+
"enumsAsTypes": true
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"$schema": "../../packages/build-tools/schema.json",
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"express": ">=4",
|
|
60
|
+
"react": ">=18",
|
|
61
|
+
"react-dom": ">=18"
|
|
37
62
|
}
|
|
38
63
|
}
|
package/react.d.ts
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import type { TSchema, Type, Static } from "@sinclair/typebox";
|
|
2
|
+
import {
|
|
3
|
+
AiAssistantProps,
|
|
4
|
+
ChatData,
|
|
5
|
+
ChatItem,
|
|
6
|
+
GetChatCompletionOptions,
|
|
7
|
+
GetStructuredResponseOptions,
|
|
8
|
+
ToolDeclaration,
|
|
9
|
+
AiAssistantSuggestedPromptsProps,
|
|
10
|
+
GetFollowUpSuggestions,
|
|
11
|
+
ChatDataFile,
|
|
12
|
+
} from "./sharedTypes";
|
|
13
|
+
|
|
14
|
+
export const getDefaultGetFollowUpSuggestions: (args: {
|
|
15
|
+
promptOverride?: string;
|
|
16
|
+
}) => GetFollowUpSuggestions;
|
|
17
|
+
|
|
18
|
+
export function AiAssistant(args: AiAssistantProps): JSX.Element;
|
|
19
|
+
|
|
20
|
+
export function AiAssistantSuggestedPrompts(
|
|
21
|
+
args: AiAssistantSuggestedPromptsProps
|
|
22
|
+
): JSX.Element;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* IMPORTANT: These types must be kept in sync with the source files:
|
|
26
|
+
* - AiResponseRating and GenAIRatingComponentProps are defined in src/frontend/components/GenAIRatingComponent.tsx
|
|
27
|
+
* - GenAIRatingComponentApolloWrappedProps is defined in src/frontend/components/GenAIRatingComponentApolloWrapped.tsx
|
|
28
|
+
*
|
|
29
|
+
* When updating these types in the source, you MUST also update them here.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
export interface AiResponseRating {
|
|
33
|
+
id: string;
|
|
34
|
+
userRating?: "THUMBS_UP" | "THUMBS_DOWN" | null;
|
|
35
|
+
userComment?: string | null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface GenAIRatingComponentProps {
|
|
39
|
+
responseType: "WTC_MESSAGE" | "SURVEY_SUMMARY" | "COMMENTS_SUMMARY";
|
|
40
|
+
responseId: string;
|
|
41
|
+
genAiMessage: string;
|
|
42
|
+
genAiMessageTimestamp: string;
|
|
43
|
+
onSubmitRating: (input: any) => Promise<any>;
|
|
44
|
+
isLoading?: boolean;
|
|
45
|
+
error?: Error;
|
|
46
|
+
aiResponseRating?: AiResponseRating | null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type GenAIRatingComponentApolloWrappedProps = Omit<
|
|
50
|
+
GenAIRatingComponentProps,
|
|
51
|
+
"onSubmitRating" | "isLoading" | "error" | "aiResponseRating"
|
|
52
|
+
> & {
|
|
53
|
+
/**
|
|
54
|
+
* Optional CSS value for the top position of success/error toasts.
|
|
55
|
+
*
|
|
56
|
+
* Use this to position toasts below fixed headers or other UI elements that might
|
|
57
|
+
* obscure them. Accepts any valid CSS top value (e.g., "80px", "5rem", "10%").
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* // Position toasts 80px from the top, below a fixed admin header
|
|
61
|
+
* <GenAIRatingComponentApolloWrapped
|
|
62
|
+
* responseType="WTC_MESSAGE"
|
|
63
|
+
* responseId={id}
|
|
64
|
+
* genAiMessage={message}
|
|
65
|
+
* genAiMessageTimestamp={timestamp}
|
|
66
|
+
* toastTop="80px"
|
|
67
|
+
* />
|
|
68
|
+
*
|
|
69
|
+
* @default undefined (uses the default toast position from Confetti)
|
|
70
|
+
*/
|
|
71
|
+
toastTop?: string;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export function GenAIRatingComponent(
|
|
75
|
+
args: GenAIRatingComponentProps
|
|
76
|
+
): JSX.Element;
|
|
77
|
+
|
|
78
|
+
export function GenAIRatingComponentApolloWrapped(
|
|
79
|
+
args: GenAIRatingComponentApolloWrappedProps
|
|
80
|
+
): JSX.Element;
|
|
81
|
+
|
|
82
|
+
export const tools: {
|
|
83
|
+
kazooTools: {
|
|
84
|
+
getRewardsAndRecognitionCurrentUserTool: ToolDeclaration;
|
|
85
|
+
};
|
|
86
|
+
sharedTools: {
|
|
87
|
+
doMathTool: ToolDeclaration;
|
|
88
|
+
getCurrentTimeTool: ToolDeclaration;
|
|
89
|
+
askSingleShotQuestion: ToolDeclaration;
|
|
90
|
+
analyzeCurrentPage: ToolDeclaration;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Helper function to define a new tool for the AI Assistant.
|
|
94
|
+
*
|
|
95
|
+
* The tool's name, description, and the full schema of its parameters (including
|
|
96
|
+
* their descriptions) are sent to the LLM at the beginning of every interaction.
|
|
97
|
+
* The LLM uses this information to understand what the tool does and decide
|
|
98
|
+
* when and how to call it.
|
|
99
|
+
*
|
|
100
|
+
* Providing a clear, descriptive tool `description` and detailed descriptions
|
|
101
|
+
* for each field in the `parameters` object is essential for reliable tool calling.
|
|
102
|
+
*/
|
|
103
|
+
createTool<TParams extends TSchema = TSchema>(args: {
|
|
104
|
+
name: string;
|
|
105
|
+
/**
|
|
106
|
+
* A description of the tool that is provided to the LLM.
|
|
107
|
+
* This tells the LLM what the tool is capable of getting or doing, helping it
|
|
108
|
+
* decide when to invoke it.
|
|
109
|
+
*/
|
|
110
|
+
description: string;
|
|
111
|
+
/**
|
|
112
|
+
* A user-friendly, present-tense name for the tool (e.g., "Performing calculations").
|
|
113
|
+
* This is shown in the AI Assistant UI while the tool is executing.
|
|
114
|
+
*/
|
|
115
|
+
displayName: string;
|
|
116
|
+
/**
|
|
117
|
+
* A user-friendly, past-tense name for the tool (e.g., "Performed calculations").
|
|
118
|
+
* This is shown in the AI Assistant's debug mode after the tool has finished executing.
|
|
119
|
+
*/
|
|
120
|
+
pastTenseDisplayName: string;
|
|
121
|
+
/**
|
|
122
|
+
* A function that returns a JSON schema (using TypeBox) defining the arguments
|
|
123
|
+
* required by the tool. Each field in the schema should include a `description`
|
|
124
|
+
* to help the LLM provide accurate values.
|
|
125
|
+
*/
|
|
126
|
+
parameters?: (t: typeof Type) => TParams;
|
|
127
|
+
/**
|
|
128
|
+
* The implementation function for the tool. This is called when the LLM
|
|
129
|
+
* decides to invoke the tool.
|
|
130
|
+
*/
|
|
131
|
+
fulfill: (args: Static<TParams>) => Promise<string | ChatDataFile>;
|
|
132
|
+
/**
|
|
133
|
+
* Currently unused. Investigate intent and potential removal before using.
|
|
134
|
+
*/
|
|
135
|
+
chatItemMatches?: (chatItem: ChatItem) => boolean;
|
|
136
|
+
}): ToolDeclaration;
|
|
137
|
+
} = {};
|
|
138
|
+
|
|
139
|
+
export const config: {
|
|
140
|
+
/**
|
|
141
|
+
* Get the URL for the LLM call.
|
|
142
|
+
*/
|
|
143
|
+
getLlmCallUrl: () => string;
|
|
144
|
+
/**
|
|
145
|
+
* Get the URL for the structured response call.
|
|
146
|
+
*/
|
|
147
|
+
getStructuredResponseUrl: () => string;
|
|
148
|
+
/**
|
|
149
|
+
* Get the URL for the Kazoo service.
|
|
150
|
+
*/
|
|
151
|
+
getKazooUrl: (urlPath: string) => string;
|
|
152
|
+
/**
|
|
153
|
+
* Get the URL for the Pulse service.
|
|
154
|
+
*/
|
|
155
|
+
getPulseUrl: (urlPath: string) => string;
|
|
156
|
+
/**
|
|
157
|
+
* Get the Pulse bearer token.
|
|
158
|
+
*/
|
|
159
|
+
getPulseBearerToken: () => string;
|
|
160
|
+
/**
|
|
161
|
+
* Set the strategy for getting Kazoo URLs.
|
|
162
|
+
*/
|
|
163
|
+
setKazooUrlStrategy: (strategy: (urlPath: string) => string) => void;
|
|
164
|
+
/**
|
|
165
|
+
* Set the strategy for getting LLM call URLs.
|
|
166
|
+
*/
|
|
167
|
+
setLlmCallUrlStrategy: (strategy: (path: string) => string) => void;
|
|
168
|
+
/**
|
|
169
|
+
* Set the strategy for getting Pulse URLs.
|
|
170
|
+
*/
|
|
171
|
+
setPulseUrlStrategy: (strategy: (urlPath: string) => string) => void;
|
|
172
|
+
/**
|
|
173
|
+
* Set the strategy for getting Pulse bearer tokens.
|
|
174
|
+
*/
|
|
175
|
+
setPulseBearerTokenStrategy: (strategy: () => string) => void;
|
|
176
|
+
/**
|
|
177
|
+
* Set the strategy for getting structured response URLs.
|
|
178
|
+
*/
|
|
179
|
+
setStructuredResponseUrlStrategy: (
|
|
180
|
+
strategy: (path: string) => string
|
|
181
|
+
) => void;
|
|
182
|
+
/**
|
|
183
|
+
* Set the main content selector for the page for when taking screenshots.
|
|
184
|
+
*/
|
|
185
|
+
setScreenshotMainContentSelector: (selector: string) => void;
|
|
186
|
+
/**
|
|
187
|
+
* Get the main content selector for the page for when taking screenshots.
|
|
188
|
+
*/
|
|
189
|
+
getScreenshotMainContentSelector: () => string;
|
|
190
|
+
/**
|
|
191
|
+
* Set the strategy for getting synthesize URLs.
|
|
192
|
+
*/
|
|
193
|
+
setSynthesizeUrlStrategy: (strategy: () => string) => void;
|
|
194
|
+
/**
|
|
195
|
+
* Set the strategy for getting transcribe URLs.
|
|
196
|
+
*/
|
|
197
|
+
setTranscribeUrlStrategy: (strategy: () => string) => void;
|
|
198
|
+
} = {};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Makes a structured response request to the LLM API.
|
|
202
|
+
*/
|
|
203
|
+
export function getStructuredResponse<T extends TSchema>(
|
|
204
|
+
args: GetStructuredResponseOptions<T>
|
|
205
|
+
): Promise<Static<T>>;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Makes a chat completion request to the LLM API. Can be used both with streaming and non-streaming responses.
|
|
209
|
+
* For streaming responses, provides callbacks for handling chunks and errors.
|
|
210
|
+
*/
|
|
211
|
+
export function getChatCompletion(
|
|
212
|
+
args: GetChatCompletionOptions
|
|
213
|
+
): Promise<ChatData[]>;
|
|
214
|
+
|
|
215
|
+
export * from "./sharedTypes";
|
package/sharedTypes.ts
ADDED
|
@@ -0,0 +1,386 @@
|
|
|
1
|
+
// Don't import from the generated folder, as it is removed when we build and publish the package.
|
|
2
|
+
|
|
3
|
+
import type { Static, TSchema, Type } from "@sinclair/typebox";
|
|
4
|
+
|
|
5
|
+
export type Maybe<T> = T | undefined;
|
|
6
|
+
export interface Scalars {
|
|
7
|
+
ID: string;
|
|
8
|
+
String: string;
|
|
9
|
+
Boolean: boolean;
|
|
10
|
+
Int: number;
|
|
11
|
+
Float: number;
|
|
12
|
+
Upload: any;
|
|
13
|
+
/** All dates within this schema are ISO-8601 strings without time or timezone. */
|
|
14
|
+
Date: any;
|
|
15
|
+
/** All date-times are supposed to be are ISO-8601 strings, but we do accept input in other formats. That behavior will change and we will replace Date and DateTime's behavior with that of StrictDate. */
|
|
16
|
+
DateTime: any;
|
|
17
|
+
/** A datetime input and output type only accepts ISO-8601 dates. */
|
|
18
|
+
StrictDateTimeInput: string;
|
|
19
|
+
/** General-use Upload input scalar */
|
|
20
|
+
FileToUpload: any;
|
|
21
|
+
/** General-use scalar to use for fields of JSON data. See https://www.npmjs.com/package/graphql-type-json for more information. */
|
|
22
|
+
JSONObject: any;
|
|
23
|
+
/** Represents a rich text document in its native ProseMirror document format. This is a JSON object with a specific schema. Use a TipTap editor instance from the @kazoohr/richtext-components package to interact with this format. */
|
|
24
|
+
RichTextDocument: any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type AiAssistantConversationMessageRole =
|
|
28
|
+
/** A message that was sent by the LLM */
|
|
29
|
+
| "MODEL"
|
|
30
|
+
/** A message comes from tool calling. */
|
|
31
|
+
| "TOOL"
|
|
32
|
+
/** A message that was sent by the user. */
|
|
33
|
+
| "USER";
|
|
34
|
+
|
|
35
|
+
export interface Message {
|
|
36
|
+
__typename?: "Message";
|
|
37
|
+
/** The unique identifier of the message. */
|
|
38
|
+
id: Scalars["ID"];
|
|
39
|
+
/** The role of the message. */
|
|
40
|
+
role: AiAssistantConversationMessageRole;
|
|
41
|
+
/** The text content of the message. */
|
|
42
|
+
messageText: Scalars["String"];
|
|
43
|
+
/** The conversation that the message belongs to. */
|
|
44
|
+
conversationId: Scalars["String"];
|
|
45
|
+
/** Optional metadata for the message to store such as toolNames etc */
|
|
46
|
+
metadata?: Maybe<Scalars["JSONObject"]>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type AiAssistantSuggestedPromptsProps = {
|
|
50
|
+
suggestedPrompts: Record<string, AiAssistantSuggestedPrompt[]>;
|
|
51
|
+
onSelect: (prompt: AiAssistantSuggestedPrompt) => void | Promise<void>;
|
|
52
|
+
includeGlobalPrompts?: boolean;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type AiAssistantSuggestedPrompt = {
|
|
56
|
+
title: string;
|
|
57
|
+
fullPrompt?: string;
|
|
58
|
+
// Allow customization of the suggested action button in the UI
|
|
59
|
+
className?: string;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type SupportedTextModel = "small" | "medium" | "large";
|
|
63
|
+
|
|
64
|
+
export type ChatItem = {
|
|
65
|
+
role: "user" | "model" | "tool";
|
|
66
|
+
parts: ChatData[];
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export type ToolDeclaration<TParams extends TSchema = TSchema> = {
|
|
70
|
+
name: string;
|
|
71
|
+
description: string;
|
|
72
|
+
/**
|
|
73
|
+
* A user-friendly, present-tense name for the tool (e.g., "Performing calculations").
|
|
74
|
+
* This is shown in the AI Assistant UI while the tool is executing.
|
|
75
|
+
*/
|
|
76
|
+
displayName: string;
|
|
77
|
+
/**
|
|
78
|
+
* A user-friendly, past-tense name for the tool (e.g., "Performed calculations").
|
|
79
|
+
* This is shown in the AI Assistant's debug mode after the tool has finished executing.
|
|
80
|
+
*/
|
|
81
|
+
pastTenseDisplayName: string;
|
|
82
|
+
parameters?: any;
|
|
83
|
+
/**
|
|
84
|
+
* Currently unused. Investigate intent and potential removal before using.
|
|
85
|
+
*/
|
|
86
|
+
chatItemMatches?: (chatItem: {
|
|
87
|
+
role: "user" | "model" | "tool";
|
|
88
|
+
parts: ChatData[];
|
|
89
|
+
}) => boolean;
|
|
90
|
+
fulfill: (result: Static<TParams>) => Promise<string | ChatDataFile>;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Debug info added during the execution of the AI assistant.
|
|
95
|
+
*/
|
|
96
|
+
export type DebugInfo = {
|
|
97
|
+
time: Date;
|
|
98
|
+
message: string;
|
|
99
|
+
data?: any;
|
|
100
|
+
level: "info" | "error" | "warn";
|
|
101
|
+
}[];
|
|
102
|
+
|
|
103
|
+
export type PropRefs = {
|
|
104
|
+
onAfterLlmCall?: (messages: Omit<Message, "__typename">[]) => void;
|
|
105
|
+
onBeforeLlmCall?: () => void;
|
|
106
|
+
onError?: (error: Error) => void;
|
|
107
|
+
onChunkAdded?: () => void;
|
|
108
|
+
tools?: ToolDeclaration[];
|
|
109
|
+
model?: SupportedTextModel;
|
|
110
|
+
/**
|
|
111
|
+
* The current state of the chat.
|
|
112
|
+
*
|
|
113
|
+
* When to access this:
|
|
114
|
+
* - When you're in async handler functions
|
|
115
|
+
* - When you're in callbacks
|
|
116
|
+
*
|
|
117
|
+
* When NOT to access this:
|
|
118
|
+
* - When you're in anywhere in the UI state rendering path
|
|
119
|
+
*
|
|
120
|
+
* If you're rendering the UI, use the `messages` prop, please. This is for
|
|
121
|
+
* AI assistant state, which often requires up-to-date state for making
|
|
122
|
+
* updates.
|
|
123
|
+
*/
|
|
124
|
+
messages: ChatStateTree;
|
|
125
|
+
temperature?: number;
|
|
126
|
+
isMounted: boolean;
|
|
127
|
+
systemInstruction?: () => string | Promise<string>;
|
|
128
|
+
getConversationById: (
|
|
129
|
+
conversationId: string
|
|
130
|
+
) => ChatStateTree[string] | undefined;
|
|
131
|
+
getFollowUpSuggestions?: GetFollowUpSuggestions;
|
|
132
|
+
setFollowUpSuggestionsByConversationId: React.Dispatch<
|
|
133
|
+
React.SetStateAction<Record<string, FollowUpSuggestion[]>>
|
|
134
|
+
>;
|
|
135
|
+
handleSendUserMessage: (args: {
|
|
136
|
+
conversationId?: string;
|
|
137
|
+
messageText: string;
|
|
138
|
+
}) => Promise<void>;
|
|
139
|
+
setPrompt: (
|
|
140
|
+
conversationId: string | undefined,
|
|
141
|
+
prompt: string | ((prev: string) => string)
|
|
142
|
+
) => void;
|
|
143
|
+
onSelectedConversationChange?: (
|
|
144
|
+
conversationId: string | undefined,
|
|
145
|
+
messages: ChatStateTree
|
|
146
|
+
) => void;
|
|
147
|
+
selectedConversationId: string | undefined;
|
|
148
|
+
onSelectedConversationLoaded?: (
|
|
149
|
+
/**
|
|
150
|
+
* The conversation that loaded.
|
|
151
|
+
*/
|
|
152
|
+
conversationId: string | undefined,
|
|
153
|
+
/**
|
|
154
|
+
* The conversation that is currently selected
|
|
155
|
+
*/
|
|
156
|
+
selectedConversationId: string | undefined,
|
|
157
|
+
messages: ChatStateTree
|
|
158
|
+
) => void;
|
|
159
|
+
sendMessages: (conversationId: string) => Promise<boolean>;
|
|
160
|
+
setMessages: React.Dispatch<React.SetStateAction<ChatStateTree>>;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export type ChatData =
|
|
164
|
+
| ChatDataText
|
|
165
|
+
| ChatDataToolCall
|
|
166
|
+
| ChatDataToolResult
|
|
167
|
+
| ChatDataFile;
|
|
168
|
+
|
|
169
|
+
export type ChatDataText = { type: "text"; text: string };
|
|
170
|
+
|
|
171
|
+
export type ChatDataFile = {
|
|
172
|
+
type: "file";
|
|
173
|
+
toolName: string;
|
|
174
|
+
fileUri: string;
|
|
175
|
+
mimeType: string;
|
|
176
|
+
args?: unknown;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export type ChatDataToolCall = {
|
|
180
|
+
type: "toolCall";
|
|
181
|
+
toolName: string;
|
|
182
|
+
args: Record<string, unknown>;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export type ChatDataToolResult = {
|
|
186
|
+
type: "toolResult";
|
|
187
|
+
toolName: string;
|
|
188
|
+
args?: unknown;
|
|
189
|
+
result: any;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export type ChatHistoryItem = {
|
|
193
|
+
title: string;
|
|
194
|
+
messages: any[];
|
|
195
|
+
[key: string]: any;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export type GetFollowUpSuggestions = (args: {
|
|
199
|
+
conversation: ChatStateTree[string];
|
|
200
|
+
}) => Promise<AiAssistantSuggestedPrompt[]>;
|
|
201
|
+
|
|
202
|
+
export type ChatHistory = Record<string, ChatHistoryItem[]>;
|
|
203
|
+
|
|
204
|
+
export type ChatSizes = "half" | "full";
|
|
205
|
+
|
|
206
|
+
export type AiAssistantControls = {
|
|
207
|
+
/**
|
|
208
|
+
* Set the prompt to use for the AI assistant.
|
|
209
|
+
* @param prompt - The prompt to set.
|
|
210
|
+
* @param submit - Whether to submit the prompt to the AI assistant once the new prompt is set.
|
|
211
|
+
*/
|
|
212
|
+
setPrompt?: (prompt: string, submit?: boolean) => void;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export type AiAssistantProps = {
|
|
216
|
+
/**
|
|
217
|
+
* The title to display in the window. Default: "WorkTango AI Assistant".
|
|
218
|
+
*/
|
|
219
|
+
windowTitle?: React.ReactNode;
|
|
220
|
+
/**
|
|
221
|
+
* The full suite of tools to use for the AI assistant.
|
|
222
|
+
*/
|
|
223
|
+
tools?: ToolDeclaration<any>[];
|
|
224
|
+
/**
|
|
225
|
+
* Whether to enable debug mode. Default: false.
|
|
226
|
+
*/
|
|
227
|
+
enableDebug?: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Whether to enable voice features. Default: false.
|
|
230
|
+
*/
|
|
231
|
+
enableVoiceFeatures?: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* The function to call when the AI assistant is closed.
|
|
234
|
+
*/
|
|
235
|
+
onClose: () => void;
|
|
236
|
+
/**
|
|
237
|
+
* This is a callback event that is invoked when the user sends a message.
|
|
238
|
+
*/
|
|
239
|
+
onSendMessage?: (message: string) => void;
|
|
240
|
+
/**
|
|
241
|
+
* Whether to show a close button in the chat window. Default: true.
|
|
242
|
+
*/
|
|
243
|
+
hasCloseButton?: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* The zero state to display when the chat window is empty.
|
|
246
|
+
*/
|
|
247
|
+
chatWindowZeroState?: React.ReactNode;
|
|
248
|
+
/**
|
|
249
|
+
* Whether to show a button to toggle the chat size. Default: true.
|
|
250
|
+
*/
|
|
251
|
+
hasToggleChatSizeButton?: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* If true, the chat history (list of past conversations) will be shown, by default
|
|
254
|
+
*/
|
|
255
|
+
hasChatHistory?: boolean;
|
|
256
|
+
/**
|
|
257
|
+
* The initial width of the chat window. Default: "default".
|
|
258
|
+
*/
|
|
259
|
+
startingWidth?: ChatSizes;
|
|
260
|
+
/**
|
|
261
|
+
* The system instruction to use for the AI assistant.
|
|
262
|
+
*/
|
|
263
|
+
systemInstruction?: () => string | Promise<string>;
|
|
264
|
+
/**
|
|
265
|
+
* The initial prompt to use for the AI assistant.
|
|
266
|
+
*/
|
|
267
|
+
initialPrompt?: string;
|
|
268
|
+
/**
|
|
269
|
+
* A ref to the controls object for the AI assistant. Used to allow some form
|
|
270
|
+
* of control over the AI assistant from outside the component, allowing things
|
|
271
|
+
* like recommended prompts to be set from outside the component.
|
|
272
|
+
*/
|
|
273
|
+
controls?: React.MutableRefObject<AiAssistantControls>;
|
|
274
|
+
/**
|
|
275
|
+
* Whether to show the chat history by default. Default: true.
|
|
276
|
+
*/
|
|
277
|
+
chatHistoryShownByDefault?: boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Otherwise, if there's a chat history, we start with the latest history, so
|
|
280
|
+
* the user can continue the previous conversation.
|
|
281
|
+
*/
|
|
282
|
+
startWithNewChat?: boolean;
|
|
283
|
+
/**
|
|
284
|
+
* The minimum number of characters that must be entered before the user can
|
|
285
|
+
* submit a message. Default: 5.
|
|
286
|
+
*/
|
|
287
|
+
minimumCharacterCount?: number;
|
|
288
|
+
/**
|
|
289
|
+
* The ID of the conversation to start with. If not provided, a new conversation will be created.
|
|
290
|
+
*/
|
|
291
|
+
initialConversationId?: string;
|
|
292
|
+
/**
|
|
293
|
+
* Returns a set of follow-up suggestions for the given conversation.
|
|
294
|
+
*/
|
|
295
|
+
getFollowUpSuggestions?: GetFollowUpSuggestions;
|
|
296
|
+
/**
|
|
297
|
+
* Invoked with a raw string of the chat (in plain text) to get a possible title
|
|
298
|
+
*/
|
|
299
|
+
getChatTitle?: (chat: string) => Promise<string>;
|
|
300
|
+
/**
|
|
301
|
+
* The model size to use for the AI assistant. Default: "large".
|
|
302
|
+
*/
|
|
303
|
+
model?: SupportedTextModel;
|
|
304
|
+
/**
|
|
305
|
+
* Whether to enable the AI response rating component. Default: false.
|
|
306
|
+
* Cannot bundle feature-flags-react in packages/ai-assistant so this is how we have to pass feature flags to the Ai Assistant.
|
|
307
|
+
*/
|
|
308
|
+
enableResponseRating?: boolean;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
export type ChatStateTree = Record<
|
|
312
|
+
string,
|
|
313
|
+
{
|
|
314
|
+
id: string;
|
|
315
|
+
title: string;
|
|
316
|
+
isUpdatingTitle?: boolean;
|
|
317
|
+
updatedAt: Date;
|
|
318
|
+
isLoading: boolean;
|
|
319
|
+
messages: Omit<Message, "__typename">[];
|
|
320
|
+
}
|
|
321
|
+
>;
|
|
322
|
+
|
|
323
|
+
// ChatItem augmented with some UI stuff
|
|
324
|
+
export type AugmentedChatItem = ChatItem & {
|
|
325
|
+
id?: string;
|
|
326
|
+
timestamp?: Date;
|
|
327
|
+
isPending?: boolean;
|
|
328
|
+
filterFromApiCalls?: boolean;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* If { loading: true }, a small loader will be shown. You can use this show a
|
|
333
|
+
* loading state in any place of the UI.
|
|
334
|
+
*/
|
|
335
|
+
export type FollowUpSuggestion =
|
|
336
|
+
| { type: "loading"; id?: string }
|
|
337
|
+
| {
|
|
338
|
+
type?: "suggestion";
|
|
339
|
+
/**
|
|
340
|
+
* A unique identifier for the follow-up suggestion. This will be used to keep user-level state for dismissed items.
|
|
341
|
+
*/
|
|
342
|
+
id: string;
|
|
343
|
+
/**
|
|
344
|
+
* The title of the follow-up suggestion. This will be displayed in the UI as a pill button, so keep it short.
|
|
345
|
+
*/
|
|
346
|
+
title: string;
|
|
347
|
+
/**
|
|
348
|
+
* The function to call when the follow-up suggestion is clicked.
|
|
349
|
+
*/
|
|
350
|
+
onClick: () => void;
|
|
351
|
+
/**
|
|
352
|
+
* Optional CSS class name for custom styling of the pill.
|
|
353
|
+
*/
|
|
354
|
+
className?: string;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
export interface Conversation {
|
|
358
|
+
id: string;
|
|
359
|
+
title: string;
|
|
360
|
+
updatedAt?: Date;
|
|
361
|
+
messages: {
|
|
362
|
+
conversationId: string;
|
|
363
|
+
id: string;
|
|
364
|
+
messageText: string;
|
|
365
|
+
role: string;
|
|
366
|
+
}[];
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
export type GetStructuredResponseOptions<T extends TSchema> = {
|
|
370
|
+
model?: SupportedTextModel | undefined;
|
|
371
|
+
temperature?: number | undefined;
|
|
372
|
+
prompt: string;
|
|
373
|
+
schema: (t: typeof Type) => T;
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
export type GetChatCompletionOptions = {
|
|
377
|
+
model?: SupportedTextModel | undefined;
|
|
378
|
+
temperature?: number | undefined;
|
|
379
|
+
systemInstruction?: string | undefined;
|
|
380
|
+
stream?: boolean;
|
|
381
|
+
messages: ChatItem[];
|
|
382
|
+
tools?: ToolDeclaration[] | undefined;
|
|
383
|
+
onChunk?: (chunk: ChatData) => void;
|
|
384
|
+
onError?: (error: Error) => void;
|
|
385
|
+
onComplete?: () => void;
|
|
386
|
+
};
|
package/express.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
require("./dist/express.js");
|
package/react.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AiAssistant } from "./dist/react.es.js";
|