@codefionn/llmleaf-client 0.2.6 → 0.2.7

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/src/index.ts CHANGED
@@ -34,6 +34,7 @@ export type {
34
34
  ErrorBody,
35
35
  TextPart,
36
36
  ImageUrlPart,
37
+ InputAudioPart,
37
38
  ContentPart,
38
39
  MessageContent,
39
40
  FunctionCall,
package/src/types.ts CHANGED
@@ -85,7 +85,17 @@ export interface ImageUrlPart {
85
85
  };
86
86
  }
87
87
 
88
- export type ContentPart = TextPart | ImageUrlPart;
88
+ export interface InputAudioPart {
89
+ type: "input_audio";
90
+ inputAudio: {
91
+ /** Base64-encoded audio bytes. */
92
+ data: string;
93
+ /** Provider-supported lowercase format, for example "wav" or "mp3". */
94
+ format: string;
95
+ };
96
+ }
97
+
98
+ export type ContentPart = TextPart | ImageUrlPart | InputAudioPart;
89
99
 
90
100
  /** Wire `content` is either a plain string or an array of content parts. */
91
101
  export type MessageContent = string | ContentPart[];
package/src/wire.ts CHANGED
@@ -136,6 +136,12 @@ function encodeContentPart(p: ContentPart): Json {
136
136
  if (p.type === "text") {
137
137
  return { type: "text", text: p.text };
138
138
  }
139
+ if (p.type === "input_audio") {
140
+ return {
141
+ type: "input_audio",
142
+ input_audio: { data: p.inputAudio.data, format: p.inputAudio.format },
143
+ };
144
+ }
139
145
  const imageUrl: Json = { url: p.imageUrl.url };
140
146
  put(imageUrl, "detail", p.imageUrl.detail);
141
147
  return { type: "image_url", image_url: imageUrl };
@@ -289,6 +295,15 @@ function decodeContent(v: unknown): MessageContent | undefined {
289
295
  type: "image_url",
290
296
  imageUrl: { url: str(iu["url"]), detail: optStr(iu["detail"]) },
291
297
  });
298
+ } else if (type === "input_audio") {
299
+ const audio = obj(p["input_audio"]) ?? {};
300
+ parts.push({
301
+ type: "input_audio",
302
+ inputAudio: {
303
+ data: str(audio["data"]),
304
+ format: str(audio["format"]),
305
+ },
306
+ });
292
307
  } else {
293
308
  parts.push({ type: "text", text: str(p["text"]) });
294
309
  }