@inkeep/cxkit-primitives 0.5.57 → 0.5.58

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.
@@ -1,9 +1,9 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=async(e,n,t)=>{const o=JSON.stringify(e.primaryFieldValues,null,2),i=JSON.stringify(e.fieldsToGenerate,null,2),s=(await n.chat.completions.create({model:"inkeep-context-expert",messages:[{role:"system",content:`You are a helpful assistant that suggests form field values based on context. You will receive form field information including field names, descriptions, input types, and available options for select fields.
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=async(t,o,s)=>{const i=JSON.stringify(t.primaryFieldValues,null,2),a=JSON.stringify(t.fieldsToGenerate,null,2),l=await o.chat.completions.create({model:"inkeep-base-expert",messages:[{role:"system",content:`You are a helpful assistant that suggests form field values based on context. You will receive form field information including field names, descriptions, input types, and available options for select fields.
2
2
 
3
3
  For each field, consider its description, input type, and available options (for select fields).
4
4
 
5
5
  You must respond with a JSON object where keys are the field names and values match the expected input type and length for that field.`},{role:"user",content:`Based on these primary field values:
6
- ${o}
6
+ ${i}
7
7
 
8
8
  Suggest values for these additional fields:
9
- ${i}`}],response_format:{type:"json_object"}},t?{headers:t}:void 0)).choices[0]?.message?.content;return{suggestedValues:s?JSON.parse(s):{}}};exports.generateContextModelResponse=a;
9
+ ${a}`}],stream:!0,response_format:{type:"json_object"}},s?{headers:s}:void 0);let e="";for await(const r of l){const n=r.choices?.[0]?.delta?.content;n&&(e+=n)}return{suggestedValues:e?JSON.parse(e):{}}};exports.generateContextModelResponse=d;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- const l = async (e, n, s) => {
3
- const o = JSON.stringify(e.primaryFieldValues, null, 2), i = JSON.stringify(e.fieldsToGenerate, null, 2), t = (await n.chat.completions.create(
2
+ const d = async (t, o, s) => {
3
+ const i = JSON.stringify(t.primaryFieldValues, null, 2), a = JSON.stringify(t.fieldsToGenerate, null, 2), l = await o.chat.completions.create(
4
4
  {
5
- model: "inkeep-context-expert",
5
+ model: "inkeep-base-expert",
6
6
  messages: [
7
7
  {
8
8
  role: "system",
@@ -15,22 +15,29 @@ You must respond with a JSON object where keys are the field names and values ma
15
15
  {
16
16
  role: "user",
17
17
  content: `Based on these primary field values:
18
- ${o}
18
+ ${i}
19
19
 
20
20
  Suggest values for these additional fields:
21
- ${i}`
21
+ ${a}`
22
22
  }
23
23
  ],
24
+ stream: !0,
25
+ // The content structure was off if streaming was not used
24
26
  response_format: {
25
27
  type: "json_object"
26
28
  }
27
29
  },
28
30
  s ? { headers: s } : void 0
29
- )).choices[0]?.message?.content;
31
+ );
32
+ let e = "";
33
+ for await (const r of l) {
34
+ const n = r.choices?.[0]?.delta?.content;
35
+ n && (e += n);
36
+ }
30
37
  return {
31
- suggestedValues: t ? JSON.parse(t) : {}
38
+ suggestedValues: e ? JSON.parse(e) : {}
32
39
  };
33
40
  };
34
41
  export {
35
- l as generateContextModelResponse
42
+ d as generateContextModelResponse
36
43
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),f=require("./user-provider.cjs"),d=t.createContext(void 0),b=({children:e})=>{const{baseSettings:n,componentType:o}=B.useInkeepConfig(),{apiKey:r,analyticsApiBaseUrl:i,tags:c,privacyPreferences:E,env:g}=n,{userProperties:a}=f.useUser(),v=t.useMemo(()=>({widgetLibraryVersion:"0.5.57",componentType:o,tags:c}),[o,c]),u=!E.optOutAllAnalytics&&g!=="development",m={logEvent:t.useCallback(async l=>{const s={...v,...l.properties},p={eventName:l.eventName,properties:s,userProperties:a};if(u){if("conversation"in s&&!s.conversation?.id)return;y.logEvent(p,r,i)}n.onEvent?.(p)},[u,n,r,i,a,v])};return P.jsx(d.Provider,{value:m,children:e})},x=()=>{const e=t.useContext(d);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=b;exports.useBaseEvents=x;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),f=require("./user-provider.cjs"),d=t.createContext(void 0),b=({children:e})=>{const{baseSettings:n,componentType:o}=B.useInkeepConfig(),{apiKey:r,analyticsApiBaseUrl:i,tags:c,privacyPreferences:E,env:g}=n,{userProperties:a}=f.useUser(),v=t.useMemo(()=>({widgetLibraryVersion:"0.5.58",componentType:o,tags:c}),[o,c]),u=!E.optOutAllAnalytics&&g!=="development",m={logEvent:t.useCallback(async l=>{const s={...v,...l.properties},p={eventName:l.eventName,properties:s,userProperties:a};if(u){if("conversation"in s&&!s.conversation?.id)return;y.logEvent(p,r,i)}n.onEvent?.(p)},[u,n,r,i,a,v])};return P.jsx(d.Provider,{value:m,children:e})},x=()=>{const e=t.useContext(d);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=b;exports.useBaseEvents=x;
@@ -7,7 +7,7 @@ import { useUser as b } from "./user-provider.js";
7
7
  const u = x(void 0), U = ({ children: e }) => {
8
8
  const { baseSettings: t, componentType: n } = C(), { apiKey: s, analyticsApiBaseUrl: r, tags: i, privacyPreferences: l, env: E } = t, { userProperties: a } = b(), c = g(
9
9
  () => ({
10
- widgetLibraryVersion: "0.5.57",
10
+ widgetLibraryVersion: "0.5.58",
11
11
  componentType: n,
12
12
  tags: i
13
13
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/cxkit-primitives",
3
- "version": "0.5.57",
3
+ "version": "0.5.58",
4
4
  "description": "",
5
5
  "license": "Inkeep, Inc. Customer License (IICL) v1.1",
6
6
  "homepage": "",
@@ -59,9 +59,9 @@
59
59
  "remark-gfm": "^4.0.1",
60
60
  "unist-util-visit": "^5.0.0",
61
61
  "use-sync-external-store": "^1.4.0",
62
- "@inkeep/cxkit-color-mode": "0.5.57",
63
- "@inkeep/cxkit-theme": "0.5.57",
64
- "@inkeep/cxkit-types": "0.5.57"
62
+ "@inkeep/cxkit-color-mode": "0.5.58",
63
+ "@inkeep/cxkit-theme": "0.5.58",
64
+ "@inkeep/cxkit-types": "0.5.58"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@biomejs/biome": "1.9.4",