@dudko.dev/agent-web 0.0.39 → 0.0.40

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/dist/index.js CHANGED
@@ -4058,12 +4058,16 @@ var decisionModelFromAiSdk = (model, options = {}) => {
4058
4058
  decide: async (question, call) => {
4059
4059
  const result = await experimental_decide({
4060
4060
  model,
4061
- state: question.context ?? "",
4061
+ // The API refuses an empty state (Google's answers 400 "Missing text in content"), and a
4062
+ // question asked without a context is its own subject.
4063
+ state: question.context?.trim() ? question.context : question.prompt,
4062
4064
  questions: {
4063
4065
  [QUESTION_KEY]: {
4064
4066
  type: "choice",
4065
4067
  instructions: question.prompt,
4066
- criteria: Object.fromEntries(question.options.map((o) => [o.id, o.description ?? ""]))
4068
+ criteria: Object.fromEntries(
4069
+ question.options.map((o) => [o.id, o.description?.trim() ? o.description : o.id])
4070
+ )
4067
4071
  }
4068
4072
  },
4069
4073
  maxRetries: options.maxRetries ?? 0,