embedding-model-ingestion
Skill0 starsChanged 6 months agoMITView on GitHub
Handles embedding model selection and batch document ingestion into vector stores. Use when processing large document corpora efficiently, swapping embedding models (OpenAI, Cohere, local), batching API calls to avoid rate limits, or building ingestion pipelines.
In this repository65 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/building-agents/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms-full.txtllms.txt
- llms.txtllms.txt
- adding-guardrailsSkill
- agent-health-timeoutSkill
- agent-permission-scopingSkill
- agent-session-isolationSkill
- agent-step-loggingSkill
- agent-supervisor-routerSkill
- agent-telemetrySkill
- async-agent-backgroundSkill
- building-agentsSkill
- building-teamsSkill
- building-toolsSkill
- calendar-scheduling-toolSkill
- callback-tracing-handlerSkill
- chain-of-thought-promptingSkill
- chat-model-configurationSkill
- code-execution-sandboxSkill
- common-agent-patternsSkill
- context-window-managementSkill
- conversation-memorySkill
- conversation-state-dbSkill
- database-query-toolSkill
- document-loadersSkill
- document-rerankingSkill
- email-notification-toolSkill
- fallback-model-chainSkill
- few-shot-injectionSkill
- filesystem-toolSkill
- human-in-the-loopSkill
- hybrid-searchSkill
- inspecting-streamsSkill
- integrating-with-laurenSkill
- json-schema-enforcementSkill
- llm-provider-connectionSkill
- llm-rate-limitingSkill
- long-term-vector-memorySkill
- managing-memorySkill
- migrating-to-lauren-aiSkill
- multi-agent-delegationSkill
- multi-tool-orchestrationSkill
- multi-turn-tool-stateSkill
- output-guardrailsSkill
- plan-and-execute-agentSkill
- prompt-injection-defenseSkill
- prompt-versioningSkill
- rag-pipelineSkill
- react-agent-loopSkill
- response-validation-retrySkill
- rest-api-toolSkill
- securing-agentsSkill
- semantic-cacheSkill
- streaming-response-handlerSkill
- structured-output-parsingSkill
- sub-agent-spawningSkill
- system-prompt-templatingSkill
- testing-agentsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 81
Use a simple deterministic embedding function in tests to avoid network calls:
- Distinctive: line 93
Always chunk large documents before embedding to stay within model context windows:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Use
codemap find "SymbolName"to locate any symbol before reading — it gives exact file + line range and is faster than grep across the whole repo.
Embedding Model Selection & Batch Ingestion
Overview
The built-in InMemoryVectorStore uses TF-IDF (no external embeddings needed).
For production use cases, you can provide pre-computed embeddings via the
embedding= parameter on upsert(), or supply a batch embedding function to
your ingestion pipeline.
Batch ingestion pattern
from lauren_ai._knowledge import KnowledgeBase, TextLoader, FixedSizeChunker
from lauren_ai._memory._vector import InMemoryVectorStore
async def batch_ingest(
kb: KnowledgeBase,
documents: list[str],
batch_size: int = 10,
) -> int:
"""Ingest documents in batches, returning total chunks indexed."""
total = 0
for i in range(0, len(documents), batch_size):
batch = documents[i : i + batch_size]
for text in batch:
count = await kb.load(TextLoader(text, is_file=False))
total += count
return totalProviding a custom embedding function
Replace the default TF-IDF with dense embeddings from any provider by passing
embedding= to store.upsert():
from openai import AsyncOpenAI
client = AsyncOpenAI()
async def embed(texts: list[str]) -> list[list[float]]:
resp = await client.embeddings.create(model="text-embedding-3-small", input=texts)
return [item.embedding for item in resp.data]
store = InMemoryVectorStore()
embeddings = await embed(["Python is a language", "JavaScript runs in browsers"])
for text, vec in zip(texts, embeddings):
await store.upsert(text, embedding=vec)Cohere embed API
import cohere
co = cohere.AsyncClient()
async def cohere_embed(texts: list[str]) -> list[list[float]]:
resp = await co.embed(texts=texts, model="embed-english-v3.0", input_type="search_document")
return resp.embeddingsMock embedding for tests
Use a simple deterministic embedding function in tests to avoid network calls:
def mock_embed_fn(texts: list[str]) -> list[list[float]]:
"""Produce a 128-d vector from word count (deterministic, no API)."""
return [[len(t.split()) * 0.1] * 128 for t in texts]Chunking before embedding
Always chunk large documents before embedding to stay within model context windows:
chunker = FixedSizeChunker(chunk_size=512, overlap=64)
kb = KnowledgeBase(store=InMemoryVectorStore(), chunker=chunker)
await kb.load(TextLoader("docs/large_manual.txt"))Batch size tuning
| Provider | Recommended batch_size | Notes |
OpenAI text-embedding-3-small | 100 | Max 2048 input texts per request |
Cohere embed-english-v3.0 | 96 | Max 96 texts per request |
| Local models | 32–64 | Depends on GPU memory |
Reference
lauren_ai._knowledge:KnowledgeBase,TextLoader,FixedSizeChunkerlauren_ai._memory._vector:InMemoryVectorStore- Skills:
rag-pipeline,vector-store-integration
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

