Text in, text out
Create an index with the titan-embed-v2 model and send plain text. Lyrcloud embeds it and keeps the text with each match.
Store documents, products or FAQs and find the closest matches by meaning, not keywords. Indexes with a model turn text into embeddings for you, so semantic search and AI answers grounded in your own data take a few lines of code. There are no servers to size and nothing idle to pay for.
// lyrcloud.json: "vectors": { "DOCS": "docs" }, "ai": "AI"
export default {
async fetch(request, env) {
const question = new URL(request.url).searchParams.get('q');
const { matches } = await env.DOCS.query(question, { topK: 3 });
const context = matches.map((m) => m.metadata.text).join('\n');
const { response } = await env.AI.run('nova-lite', {
system: `Answer only from this:\n${context}`,
prompt: question,
});
return Response.json({ answer: response });
},
};
// $ lyrcloud vectors create docs --model titan-embed-v2
// $ lyrcloud vectors add docs faq-1 "Refunds take five business days."
// $ lyrcloud vectors query docs "how long is a refund?"
Create an index with the titan-embed-v2 model and send plain text. Lyrcloud embeds it and keeps the text with each match.
Any embedding up to 4,096 dimensions, with cosine or euclidean distance.
Attach strings, numbers, booleans and lists, then filter with $eq, $in, $gte, $and and more.
Bind env.VECTORS next to env.AI: query for context, then answer with any model on the AI Gateway.
Vectors live on object storage built for billions of entries, so a big index costs little to keep.
Launch: 2 indexes, 200,000 writes and 200,000 queries a month. Scale: 20 indexes, 5M each. Enterprise: 100 indexes, 50M each.
Register or transfer a domain with free WHOIS privacy and Lyrcloud DNS, paid by card or with Lyrpay.
Learn moreResponse caching, static files and whole static sites for your edge functions, with cache headers you control and purges from the CLI.
Learn moreRate limits, IP rules, a firewall for common attacks, bot checks and secure headers for your edge functions, set in lyrcloud.json and enforced before your code runs.
Learn moreCreate a free account in under a minute. No credit card required.