Common Use Cases
- Semantic search — find documents that are conceptually related to a query, not just keyword-matched
- Retrieval-augmented generation (RAG) — embed your knowledge base, retrieve the most relevant chunks at query time, and pass them as context to a chat completion
- Document clustering — group large document sets by topic without predefined labels
- Recommendation — surface items similar to what a user has already engaged with
- Classification — train a lightweight classifier on top of embeddings as features
Generate an Embedding
Make aPOST request to https://api.swytcho.com/v1/embeddings with your model and the input text.
Response Format
The API returns an object with adata array. Each entry corresponds to one input string and contains the embedding vector at embedding.
result["data"][0]["embedding"]. Store it as a list of floats in your database or vector store.
Batch Embedding
Pass an array of strings asinput to embed multiple texts in a single API call. The response data array preserves the original order via the index field.
Python
Computing Cosine Similarity
Cosine similarity measures how closely two embedding vectors point in the same direction. A score of1.0 means identical meaning; 0.0 means unrelated.
Python
Storage and Dimensions
The
swytcho-embed model produces 1,536-dimensional vectors. Each dimension is a 32-bit float (4 bytes), so a single embedding occupies roughly 6 KB. Plan your storage accordingly: one million embeddings require approximately 6 GB of raw vector storage before any index overhead. If your use case is storage-constrained, check whether your vector database supports product quantization or dimensionality reduction.