~/docs/api_reference/embeddings.md
2,942 bytesยทedit on github โ†’

#Embeddings

Generate dense vector representations of text in cave-neural latent space. Useful for semantic search, clustering, RAG pipelines, and detecting goblin-aligned content.

http
POST https://api.gpt-gob.ai/v1/embeddings

##Embedding models

Model IDDimensionsBest for
gob-embed-cave-small512High-volume RAG, low-latency search
gob-embed-cave1536General purpose. Default.
gob-embed-cave-large3072Maximum recall, semantic clustering
gob-embed-shadow1536Specialized for subtext / implicit context detection

The shadow variant uses the Shadow Attention layer to encode what's not said alongside what is. Use it for sarcasm detection, intent classification, or any task where the surface meaning isn't enough.

##Request

bash
curl https://api.gpt-gob.ai/v1/embeddings \
-H "Authorization: Bearer $GOB_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gob-embed-cave",
"input": "the quick brown goblin jumps over the lazy dragon"
}'

You can also pass an array of strings (up to 2048 inputs per request, 8192 tokens each):

json
{
  "model": "gob-embed-cave",
  "input": [
    "first piece of text",
    "second piece of text",
    "third piece of text"
  ]
}

##Response

json
{
  "object": "list",
  "model": "gob-embed-cave",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0123, -0.0456, 0.0789, "..."]
    }
  ],
  "usage": {
    "prompt_tokens": 11,
    "total_tokens": 11
  }
}

##Dimensions parameter

For gob-embed-cave and gob-embed-cave-large, you can request a smaller-than-native vector via the dimensions parameter. The model truncates the output to the requested dimensions, with minimal accuracy loss thanks to Matryoshka representation learning.

json
{
  "model": "gob-embed-cave-large",
  "input": "...",
  "dimensions": 256
}

##Encoding format

By default embeddings come back as JSON arrays of floats. For wire efficiency, request base64:

json
{
  "model": "gob-embed-cave",
  "input": "...",
  "encoding_format": "base64"
}

##Cosine similarity

Standard cosine similarity works on GOB embeddings just like any other model. They're already L2-normalized, so dot product == cosine similarity.

python
import numpy as np

def similarity(a, b):
    return float(np.dot(a, b))

##Caveats

  • โ–ธCave-neural embeddings are not interchangeable with OpenAI's text-embedding-3-* or any other model's vectors. You can't compare them across spaces.
  • โ–ธThe shadow variant produces vectors that drift further from surface semantics. Don't mix cave and shadow embeddings in the same index.
  • โ–ธMaximum input is 8192 tokens per item. Longer inputs are silently truncated.