Skip to content

Feature: v3/embeddings new page - #37

Merged
tristantelleb merged 5 commits into
mainfrom
feature/embeddings
May 5, 2026
Merged

Feature: v3/embeddings new page#37
tristantelleb merged 5 commits into
mainfrom
feature/embeddings

Conversation

@tristantelleb

@tristantelleb tristantelleb commented May 4, 2026

Copy link
Copy Markdown
Member

I did a page with a good SEO aspect might be a bit different from the responses and chat completion, I will add some content on them to on the next PR

Summary by CodeRabbit

  • Documentation
    • Added a new V3 LLMs embeddings documentation page describing embeddings and core use cases (RAG, semantic search, recommendations, clustering, deduplication, anomaly detection, classification). Includes API endpoint reference with parameters and examples, batching semantics, encoding formats, response shape, model selection guidance, error codes, best practices (caching, chunking, re-indexing), and related resources.

@mintlify

mintlify Bot commented May 4, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
edenai 🟢 Ready View Preview May 4, 2026, 2:16 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@coderabbitai

coderabbitai Bot commented May 4, 2026

Copy link
Copy Markdown

Walkthrough

Added a new V3 LLMs documentation page for embeddings (v3/llms/embeddings) with examples, schemas, guidance, and best practices; updated the docs navigation to include the new page.

Changes

Documentation Addition

Layer / File(s) Summary
Navigation Configuration
docs.json
Inserted "v3/llms/embeddings" into navigation.versions[].tabs[].groups[] for the V3 DocumentationLLMs group.
Frontmatter / Intro
v3/llms/embeddings.mdx
Adds page metadata and an introduction to embeddings and Eden AI's OpenAI-compatible embeddings endpoints.
Examples: Listing Models
v3/llms/embeddings.mdx
Adds GET /v3/embeddings/models example (Python, cURL) and notes model metadata fields.
Examples: Create Embeddings
v3/llms/embeddings.mdx
Adds POST /v3/embeddings examples (Python, cURL) showing runtime model selection and extracting embeddings/cost.
Worked Example: Semantic Search
v3/llms/embeddings.mdx
Provides end-to-end semantic-search example batching query + corpus, computing cosine similarity, and ranking results.
API Schema / Fields
v3/llms/embeddings.mdx
Documents POST /v3/embeddings request fields (model, input, encoding_format, dimensions, user, metadata) and response shape (per-item embedding, index, usage, Eden cost).
Batching Semantics
v3/llms/embeddings.mdx
Explains input order preservation, batching tradeoffs for cost/performance.
Guidance / Best Practices
v3/llms/embeddings.mdx
Adds model selection guidance, error codes table, best-practice bullets (cosine similarity, caching, re-indexing, chunking), and related links to other V3 pages.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐰 In vectors warm where meanings meet,
I hop through docs on nimble feet,
Queries bloom and search takes flight,
Numbers hum with soft delight,
Embeddings guide the rabbit's light.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feature: v3/embeddings new page' accurately describes the main change: adding a new documentation page for v3 embeddings, which is supported by both the docs.json navigation update and the new embeddings.mdx file.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/embeddings

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
v3/llms/embeddings.mdx (1)

119-126: ⚡ Quick win

Clarify/remove “smart routing” wording inside the embeddings worked example corpus.

In the worked example corpus (lines ~123-124), there’s a sentence about smart routing and @edenai, but later (lines ~225-226) the page states smart routing is not supported on embeddings. To reduce confusion, tweak that corpus sentence to explicitly say smart routing applies to chat/completions (not embeddings), or remove that line from the corpus example.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v3/llms/embeddings.mdx` around lines 119 - 126, The corpus entry in the
embeddings worked example (the array named corpus used with query) contains a
misleading sentence about smart routing and `@edenai`; update that specific
corpus element to either remove it or change its text to explicitly state that
smart routing with `@edenai` applies to chat/completions (not embeddings).
Locate the corpus array and replace the line "Smart routing picks an LLM
automatically when you pass `@edenai` as the model." with a clarifying sentence
such as "Smart routing with `@edenai` applies to chat/completions, not to
embeddings." to avoid confusion. Ensure only that corpus element is changed and
leave the rest of the corpus and the query variable intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@v3/llms/embeddings.mdx`:
- Around line 21-86: Vale is flagging “Deduplication” and “model_id” due to
hidden/look‑alike characters or smart quotes; open the MDX around those tokens
(the list item containing Deduplication and the code block that sets model_id),
remove any non‑ASCII or zero‑width characters, convert smart/curly quotes to
straight quotes, and retype the words so “Deduplication” uses a plain ASCII
D/e/d... sequence and the identifier model_id uses a normal underscore
character; then save and re-run the validator to confirm the warnings are gone.
- Around line 44-149: Update all placeholder auth tokens to match repo
guidelines: replace literal "YOUR_API_KEY" and "Authorization: Bearer
YOUR_API_KEY" with the approved placeholders (e.g., use Authorization: Bearer
<api_key> in curl and use variable names like api_token or sandbox_api_token for
Python examples). Locate and edit the headers and API key variables in examples
that define headers or API_KEY (references: headers, API_KEY, model_id, and the
curl -H lines) so they read the approved placeholder names and string form;
ensure Content-Type usage remains unchanged. Run a quick grep for "YOUR_API_KEY"
and "Authorization: Bearer" to catch all occurrences and apply the same rename
consistently across the snippets.

---

Nitpick comments:
In `@v3/llms/embeddings.mdx`:
- Around line 119-126: The corpus entry in the embeddings worked example (the
array named corpus used with query) contains a misleading sentence about smart
routing and `@edenai`; update that specific corpus element to either remove it
or change its text to explicitly state that smart routing with `@edenai` applies
to chat/completions (not embeddings). Locate the corpus array and replace the
line "Smart routing picks an LLM automatically when you pass `@edenai` as the
model." with a clarifying sentence such as "Smart routing with `@edenai` applies
to chat/completions, not to embeddings." to avoid confusion. Ensure only that
corpus element is changed and leave the rest of the corpus and the query
variable intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9b14c961-8ce2-44b9-8c2b-d9901b976426

📥 Commits

Reviewing files that changed from the base of the PR and between 880c275 and 58fc023.

📒 Files selected for processing (2)
  • docs.json
  • v3/llms/embeddings.mdx

Comment thread v3/llms/embeddings.mdx
Comment on lines +21 to +86
- **Retrieval-Augmented Generation (RAG)** — embed your docs, retrieve the most relevant chunks for a user question, feed them into an LLM.
- **Semantic search** — match queries against documents by meaning, not keywords.
- **Recommendations** — suggest similar products, articles, or songs based on description vectors.
- **Clustering and topic discovery** — group thousands of texts by meaning without labels.
- **Deduplication** — find near-duplicates that don't share exact wording.
- **Anomaly detection** — flag inputs that look unlike anything in your corpus.
- **Classification** — train a small classifier on top of frozen embeddings instead of fine-tuning a full model.

## Endpoints

```
GET /v3/embeddings/models List available embedding models
POST /v3/embeddings Create embeddings
```

Models are identified as `provider/model` — the same format used everywhere else in V3.

## List available models

<CodeGroup>
```python Python
import requests

response = requests.get(
"https://api.edenai.run/v3/embeddings/models",
headers={"Authorization": "Bearer YOUR_API_KEY"},
)

for model in response.json()["data"]:
print(model["id"], "-", model.get("context_length"))
```

```bash cURL
curl https://api.edenai.run/v3/embeddings/models \
-H "Authorization: Bearer YOUR_API_KEY"
```
</CodeGroup>

Each item exposes `id`, `owned_by`, `context_length`, `pricing`, `capabilities`, and `regions`. Use any `id` as the `model` field below.

## Create embeddings

The example picks a model from the catalog at runtime so the snippet never goes stale.

<CodeGroup>
```python Python
import requests

headers = {"Authorization": "Bearer YOUR_API_KEY"}

model_id = requests.get(
"https://api.edenai.run/v3/embeddings/models",
headers=headers,
).json()["data"][0]["id"]

response = requests.post(
"https://api.edenai.run/v3/embeddings",
headers={**headers, "Content-Type": "application/json"},
json={
"model": model_id,
"input": "The quick brown fox jumps over the lazy dog",
},
).json()

vector = response["data"][0]["embedding"]
print(f"{model_id}: {len(vector)} dimensions, cost=${response['cost']}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix vale-spellcheck warnings to avoid doc validation failures.

Vale spellcheck is warning about:

  • Line ~25: “Deduplication”
  • Line ~71: “model_id”

Even though the excerpt looks correct, the validation tool is still flagging them—so please re-check the source MDX around those lines (look for hidden Unicode, smart quotes, or look-alike characters) and update wording/identifiers until the warnings disappear.

🧰 Tools
🪛 Betterleaks (1.1.2)

[high] 54-55: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🪛 GitHub Check: Mintlify Validation (edenai) - vale-spellcheck

[warning] 25-25: v3/llms/embeddings.mdx#L25
Did you really mean 'Deduplication'?


[warning] 71-71: v3/llms/embeddings.mdx#L71
Did you really mean 'model_id'?

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v3/llms/embeddings.mdx` around lines 21 - 86, Vale is flagging
“Deduplication” and “model_id” due to hidden/look‑alike characters or smart
quotes; open the MDX around those tokens (the list item containing Deduplication
and the code block that sets model_id), remove any non‑ASCII or zero‑width
characters, convert smart/curly quotes to straight quotes, and retype the words
so “Deduplication” uses a plain ASCII D/e/d... sequence and the identifier
model_id uses a normal underscore character; then save and re-run the validator
to confirm the warnings are gone.

Comment thread v3/llms/embeddings.mdx
Comment on lines +44 to +149
response = requests.get(
"https://api.edenai.run/v3/embeddings/models",
headers={"Authorization": "Bearer YOUR_API_KEY"},
)

for model in response.json()["data"]:
print(model["id"], "-", model.get("context_length"))
```

```bash cURL
curl https://api.edenai.run/v3/embeddings/models \
-H "Authorization: Bearer YOUR_API_KEY"
```
</CodeGroup>

Each item exposes `id`, `owned_by`, `context_length`, `pricing`, `capabilities`, and `regions`. Use any `id` as the `model` field below.

## Create embeddings

The example picks a model from the catalog at runtime so the snippet never goes stale.

<CodeGroup>
```python Python
import requests

headers = {"Authorization": "Bearer YOUR_API_KEY"}

model_id = requests.get(
"https://api.edenai.run/v3/embeddings/models",
headers=headers,
).json()["data"][0]["id"]

response = requests.post(
"https://api.edenai.run/v3/embeddings",
headers={**headers, "Content-Type": "application/json"},
json={
"model": model_id,
"input": "The quick brown fox jumps over the lazy dog",
},
).json()

vector = response["data"][0]["embedding"]
print(f"{model_id}: {len(vector)} dimensions, cost=${response['cost']}")
```

```bash cURL
# Replace MODEL_ID with any id returned by GET /v3/embeddings/models
curl https://api.edenai.run/v3/embeddings \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID",
"input": "The quick brown fox jumps over the lazy dog"
}'
```
</CodeGroup>

## Worked example: semantic search

This is the smallest end-to-end example that demonstrates the full retrieval pattern: embed a query and a small corpus in **one batched call**, score with cosine similarity, return the top matches.

```python Python
import requests
import numpy as np

API_KEY = "YOUR_API_KEY"
headers = {"Authorization": f"Bearer {API_KEY}"}

# 1. Pick a model from the catalog.
model_id = requests.get(
"https://api.edenai.run/v3/embeddings/models",
headers=headers,
).json()["data"][0]["id"]

# 2. Define a query and a corpus of documents to search over.
query = "How do I track my API costs?"
corpus = [
"Eden AI returns a `cost` field on every response so you can track spend per call.",
"You can set a monthly budget cap from the dashboard under Plans & Pricing.",
"Smart routing picks an LLM automatically when you pass `@edenai` as the model.",
"The /v3/models endpoint lists every available chat-completions model.",
"To upload files for vision-capable LLMs, use the /v3/upload endpoint.",
]

# 3. Embed query + corpus in a single batched call. Eden returns vectors in input order.
payload = {"model": model_id, "input": [query, *corpus]}
response = requests.post(
"https://api.edenai.run/v3/embeddings",
headers={**headers, "Content-Type": "application/json"},
json=payload,
).json()

vectors = np.array([item["embedding"] for item in response["data"]])
query_vec, corpus_vecs = vectors[0], vectors[1:]

# 4. Cosine similarity = dot product of L2-normalized vectors.
def normalize(v):
return v / np.linalg.norm(v, axis=-1, keepdims=True)

scores = normalize(corpus_vecs) @ normalize(query_vec)
ranking = np.argsort(scores)[::-1]

print(f"Embedded {len(corpus) + 1} texts for ${response['cost']:.6f}\n")
for rank, idx in enumerate(ranking[:3], start=1):
print(f"{rank}. ({scores[idx]:.3f}) {corpus[idx]}")
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix auth header/token placeholders to match docs guidelines (and avoid secret scanners).

The MDX examples currently use Authorization: Bearer YOUR_API_KEY and an API_KEY variable, but the repo guidance says to use Authorization: Bearer <api_key> and api_token / sandbox_api_token in examples. This is also what triggered the Betterleaks findings for the curl headers (see lines ~54-55 and ~91-92).

✅ Suggested change (apply across the code snippets)
-headers={"Authorization": "Bearer YOUR_API_KEY"},
+headers={"Authorization": "Bearer <api_key>"},

-  -H "Authorization: Bearer YOUR_API_KEY"
+  -H "Authorization: Bearer <api_key>"

-headers = {"Authorization": "Bearer YOUR_API_KEY"}
+api_token = "YOUR_API_TOKEN"
+headers = {"Authorization": f"Bearer {api_token}"}

-  -H "Authorization: Bearer YOUR_API_KEY" \
+  -H "Authorization: Bearer <api_key>" \

For the worked example, rename:

-API_KEY = "YOUR_API_KEY"
-headers = {"Authorization": f"Bearer {API_KEY}"}
+api_token = "YOUR_API_TOKEN"
+headers = {"Authorization": f"Bearer {api_token}"}

This should satisfy the coding guidelines and reduce the chance of security-scanner failures on placeholders.

🧰 Tools
🪛 Betterleaks (1.1.2)

[high] 54-55: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)


[high] 91-92: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.

(curl-auth-header)

🪛 GitHub Check: Mintlify Validation (edenai) - vale-spellcheck

[warning] 71-71: v3/llms/embeddings.mdx#L71
Did you really mean 'model_id'?

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v3/llms/embeddings.mdx` around lines 44 - 149, Update all placeholder auth
tokens to match repo guidelines: replace literal "YOUR_API_KEY" and
"Authorization: Bearer YOUR_API_KEY" with the approved placeholders (e.g., use
Authorization: Bearer <api_key> in curl and use variable names like api_token or
sandbox_api_token for Python examples). Locate and edit the headers and API key
variables in examples that define headers or API_KEY (references: headers,
API_KEY, model_id, and the curl -H lines) so they read the approved placeholder
names and string form; ensure Content-Type usage remains unchanged. Run a quick
grep for "YOUR_API_KEY" and "Authorization: Bearer" to catch all occurrences and
apply the same rename consistently across the snippets.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
v3/llms/embeddings.mdx (1)

46-47: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use the approved auth placeholder and token variable names consistently.

The examples still use YOUR_API_KEY / API_KEY and Bearer YOUR_API_KEY. Please switch to the documented convention (Authorization: Bearer <api_key>, and api_token or sandbox_api_token in code) to align with docs policy and avoid secret-scanner noise.

Suggested patch
-response = requests.get(
-    "https://api.edenai.run/v3/embeddings/models",
-    headers={"Authorization": "Bearer YOUR_API_KEY"},
-)
+response = requests.get(
+    "https://api.edenai.run/v3/embeddings/models",
+    headers={"Authorization": "Bearer <api_key>"},
+)
@@
-curl https://api.edenai.run/v3/embeddings/models \
-  -H "Authorization: Bearer YOUR_API_KEY"
+curl https://api.edenai.run/v3/embeddings/models \
+  -H "Authorization: Bearer <api_key>"
@@
-headers = {"Authorization": "Bearer YOUR_API_KEY"}
+api_token = "YOUR_API_TOKEN"
+headers = {"Authorization": f"Bearer {api_token}"}
@@
-curl https://api.edenai.run/v3/embeddings \
-  -H "Authorization: Bearer YOUR_API_KEY" \
+curl https://api.edenai.run/v3/embeddings \
+  -H "Authorization: Bearer <api_key>" \
   -H "Content-Type: application/json" \
@@
-API_KEY = "YOUR_API_KEY"
-headers = {"Authorization": f"Bearer {API_KEY}"}
+api_token = "YOUR_API_TOKEN"
+headers = {"Authorization": f"Bearer {api_token}"}

As per coding guidelines, "Use Authorization: Bearer <api_key> header format for API authentication in code examples" and "Distinguish token types in code examples: api_token for production and sandbox_api_token for testing (no real provider calls)".

Also applies to: 54-56, 69-70, 91-93, 109-111

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@v3/llms/embeddings.mdx` around lines 46 - 47, Replace all occurrences of the
literal placeholders "YOUR_API_KEY" / "API_KEY" and the header value "Bearer
YOUR_API_KEY" with the approved conventions: use the header "Authorization:
Bearer <api_key>" and in code examples use the variable names api_token for
production examples or sandbox_api_token for test/sandbox examples; specifically
update the header object that currently reads "Authorization": "Bearer
YOUR_API_KEY" and any variables named API_KEY to api_token or sandbox_api_token
so examples follow the documented auth placeholder convention.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@v3/llms/embeddings.mdx`:
- Around line 46-47: Replace all occurrences of the literal placeholders
"YOUR_API_KEY" / "API_KEY" and the header value "Bearer YOUR_API_KEY" with the
approved conventions: use the header "Authorization: Bearer <api_key>" and in
code examples use the variable names api_token for production examples or
sandbox_api_token for test/sandbox examples; specifically update the header
object that currently reads "Authorization": "Bearer YOUR_API_KEY" and any
variables named API_KEY to api_token or sandbox_api_token so examples follow the
documented auth placeholder convention.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c48202ce-486e-4cd1-9e8b-899615367109

📥 Commits

Reviewing files that changed from the base of the PR and between 58fc023 and 1f49461.

📒 Files selected for processing (2)
  • docs.json
  • v3/llms/embeddings.mdx
✅ Files skipped from review due to trivial changes (1)
  • docs.json

@tristantelleb
tristantelleb merged commit 85a2a09 into main May 5, 2026
5 of 6 checks passed
@tristantelleb
tristantelleb deleted the feature/embeddings branch May 5, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant