write-language 0.1.93 → 0.1.95

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 CHANGED
@@ -2,12 +2,9 @@
2
2
  <br />
3
3
  <a href="https://www.npmjs.com/package/write-language"><img src="https://img.shields.io/npm/dm/write-language.svg" alt="NPM Monthly Downloads"></a>
4
4
  <a href="https://www.npmjs.com/package/write-language"><img src="https://img.shields.io/npm/v/write-language.svg" alt="npm version"></a>
5
- <a href="https://bundlephobia.com/package/write-language" target="_blank" rel="noopener noreferrer">
6
- <img
7
- src="https://img.shields.io/bundlephobia/minzip/write-language?style=flat&label=size"
8
- alt="npm bundle size "
9
- />
10
- </a>
5
+ <a href="https://packagephobia.com/result?p=write-language" target="_blank" rel="noopener noreferrer">
6
+ <img src="https://packagephobia.com/badge?p=write-language" alt="install size" />
7
+ </a>
11
8
  <a href="https://discord.gg/SJdBqBz3tV">
12
9
  <img src="https://img.shields.io/discord/1110227955554209923.svg?label=Chat&logo=Discord&colorB=7289da&style=flat"
13
10
  alt="Join Discord" />
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { GenerateLanguageOptions, GenerateLanguageResult } from './generation-types';
2
- export type { LLMProviderName, GenerateLanguageOptions, GenerateLanguageResult, } from './generation-types';
2
+ export type { LLMProviderName, GenerateLanguageOptions, GenerateLanguageResult, LanguageAttachment, } from './generation-types';
3
3
  export { convertMarkdownToHTMLEscaped } from './utils/markdown-to-html';
4
4
  /**
5
5
  * ### Generate Language Response
@@ -4,6 +4,30 @@
4
4
  */
5
5
  /** Supported LLM provider identifiers */
6
6
  export type LLMProviderName = "nvidia" | "openrouter" | "anthropic" | "google" | "openai" | "xai" | "groq" | "cloudflare" | "perplexity" | "amazon" | "bedrock" | "togetherai" | (string & {});
7
+ /**
8
+ * A file or image attachment passed to the model alongside the text prompt.
9
+ *
10
+ * The Vercel AI SDK accepts these as multimodal message content parts:
11
+ * images become `{ type: "image", image }` parts and every other media type
12
+ * becomes a `{ type: "file", data, mediaType }` part. `data` may be a base64
13
+ * string, a `data:` URL, an `http(s)` URL, a `URL` instance, or raw bytes.
14
+ */
15
+ export interface LanguageAttachment {
16
+ /** MIME type, e.g. `"image/png"`, `"application/pdf"`. */
17
+ mediaType: string;
18
+ /**
19
+ * The attachment payload: a base64 string, a `data:`/`http(s)` URL, a `URL`
20
+ * instance, or raw bytes (`Uint8Array`/`ArrayBuffer`).
21
+ */
22
+ data: string | Uint8Array | ArrayBuffer | URL;
23
+ /** Optional original filename (used by providers that surface it). */
24
+ filename?: string;
25
+ /**
26
+ * Force how the part is sent. Defaults to auto-detection from `mediaType`
27
+ * (`image/*` → image part, otherwise a file part).
28
+ */
29
+ kind?: "image" | "file";
30
+ }
7
31
  /**
8
32
  * Configuration options for {@link writeLanguageResponse}.
9
33
  */
@@ -31,6 +55,12 @@ export interface GenerateLanguageOptions {
31
55
  article?: string;
32
56
  /** Prior conversation history for context-aware agents */
33
57
  chat_history?: string;
58
+ /**
59
+ * File and image attachments to send to the model alongside the prompt.
60
+ * When present, the request is issued as a multimodal `messages` call so the
61
+ * model receives the uploaded files (images and documents) directly.
62
+ */
63
+ attachments?: LanguageAttachment[];
34
64
  /** Return `HTML` (`true`) or raw Markdown (`false`). Default: `true` */
35
65
  html?: boolean;
36
66
  /** Truncate the prompt to the model's context window length. Default: `true` */
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * @author ai-research-agent contributors
10
10
  */
11
11
  export { writeLanguageResponse, convertMarkdownToHTMLEscaped, } from './generate-response';
12
- export type { LLMProviderName, GenerateLanguageOptions, GenerateLanguageResult, } from './generate-response';
12
+ export type { LLMProviderName, GenerateLanguageOptions, GenerateLanguageResult, LanguageAttachment, } from './generate-response';
13
13
  export type { AgentPrompt, AgentTool, } from './generation-types';
14
14
  export { AGENT_PROMPTS, extractJSONFromLanguageReply } from './prompt-templates';
15
15
  export { LANGUAGE_MODELS, LANGUAGE_PROVIDERS, getModelsByProvider, getAllModels, getModelsByCapability, getTextOnlyModels, getMultimodalModels, } from './language-model-registry';
@@ -0,0 +1,10 @@
1
+ export interface RewriteMode {
2
+ id: string;
3
+ name: string;
4
+ prompt: string;
5
+ color?: string;
6
+ }
7
+ export declare const DEFAULT_REWRITE_MODES: RewriteMode[];
8
+ export declare const getRewriteModes: () => RewriteMode[];
9
+ export declare const saveRewriteModes: (modes: RewriteMode[]) => void;
10
+ export declare const resetRewriteModes: () => void;
@@ -0,0 +1 @@
1
+ export {};