ask-write-language

Generates text through one multi-provider LLM call using the Vercel AI SDK.

74|11|Updated Jul 4, 2024
One-click install
npx skills add https://github.com/OpenSourceAGI/qwksearch-research-agent --skill ask-write-language-opensourceagi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ask-write-language
Source: https://github.com/OpenSourceAGI/qwksearch-research-agent/tree/main/skills/ask-write-language
Command: npx skills add https://github.com/OpenSourceAGI/qwksearch-research-agent --skill ask-write-language-opensourceagi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Calling different LLM providers normally means juggling separate SDKs, credential formats, and prompt templates. This Skill documents write-language, a package that wraps the Vercel AI SDK behind a single writeLanguageResponse() call with a registry of providers, models, and named prompt templates, so you can switch providers or debug failures without relearning each API. ## Core Features & Use Cases - One-call multi-provider generation: Call writeLanguageResponse() with a provider, apiKey, and agent name to generate HTML or Markdown output across Groq, OpenAI, Anthropic, Google, Vertex, Bedrock, Cloudflare, and more. - Prompt template registry: Use AGENT_PROMPTS templates like question, summarize, answer-cite-sources, and knowledge-graph-nodes, with before/after hooks that parse structured output into result.extract. - Provider and model registry: Query LANGUAGE_MODELS, getModelsByProvider(), or getModelsByCapability() to discover valid providers and vision- or reasoning-capable models. - Use Case: You need to add a new LLM provider to your app. Follow the Skill to add a case to createLLMProvider and a registry entry, then validate it with the packed apiKey format rules for Cloudflare, Vertex, or Bedrock. ## Quick Start Ask the AI to call writeLanguageResponse with provider groq, your API key, the question agent, and a query, then read the error field before using the returned content.

Frequently Asked Questions about ask-write-language

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I call multiple LLM providers with one API in TypeScript?

Use writeLanguageResponse() from the write-language package with a provider name, apiKey, agent template, and query. It wraps the Vercel AI SDK's generateText and supports Groq, OpenAI, Anthropic, Google, Vertex, Bedrock, Cloudflare, and others through one registry.

How do I add a new LLM provider to the Vercel AI SDK registry?

Add a case to createLLMProvider in src/provider-factory.ts returning an AI SDK model, then add an entry with provider, default, and model list to LANGUAGE_MODELS. Skipping the registry entry causes validation to reject the provider even if the factory case works.

Why does writeLanguageResponse return an error instead of throwing?

The function returns failures as { error: "..." } on the result object rather than throwing exceptions. Always check the error field before reading content, since a try/catch alone will not catch an invalid provider name or missing API key.

How do I pass credentials for Cloudflare, Vertex, or Bedrock providers?

Pack multiple credentials into the single apiKey argument using colon-joined strings: token:accountId for Cloudflare, projectId:location for Vertex, and region:accessKeyId:secretAccessKey for Amazon Bedrock. A bare token fails because the base URL or region cannot be derived.

Does write-language support image or document attachments?

Yes, passing an attachments array switches the call from a prompt string to a multimodal messages request. Use a model from getMultimodalModels() or getModelsByCapability("vision"), otherwise the attachments may be ignored or rejected.

Why is my long article truncated in the generated response?

The applyContextLimit option defaults to true and truncates the prompt to the model's context length, silently dropping the tail of long articles. Pass applyContextLimit: false or chunk the document before calling.