Skip to main content

Scenario

Embed your existing content library using OpenAI’s text-embedding-3-large model, then use cosine similarity to identify content gaps. Feed the gap analysis to Mavera Generate to produce drafts that fill holes in your coverage. Flow: OpenAI POST /embeddings → vector store → cosine similarity gap detection → Mavera POST /generations → Gap-filling content

Code

Example Output

Error Handling

text-embedding-3-large produces 3,072-dimensional vectors by default. Pass dimensions=1536 or dimensions=256 for smaller vectors. Ensure all vectors in your store use the same dimensionality.
The embeddings endpoint accepts up to 2,048 inputs per request. For larger libraries, batch in groups of 1,000 with a 1-second delay between batches.
The 0.35 threshold is a starting point. Niche technical content clusters tighter (use 0.45), while broad marketing content spreads wider (use 0.25). Adjust based on your domain.