Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AISecurityLab Hackagent Embeddings

From Leeroopedia
Knowledge Sources
Domains Model_Adapter, Embeddings
Last Updated 2026-10-29 00:00 GMT

Overview

Concrete embedding provider request helpers shared by retrieval and preflight, resolving provider endpoints, credentials, and normalizing OpenAI-compatible embedding endpoints, provided by the HackAgent models package.

Description

The embeddings module provides normalize_embedding_endpoint() which converts various endpoint spellings (Ollama native, OpenAI-compatible) into a clean API base. embedding_request_kwargs() resolves provider, endpoint, and credentials from a config dict without consulting storage. Numpy is imported on use so a bare install can import preflight.

Usage

  • RAG attack: The RAG attack uses embedding helpers to build the embedding client.
  • AutoDAN-Turbo: The embedder role uses these helpers for endpoint resolution.
  • Preflight: The preflight check uses embeddings to verify embedder reachability.

Code Reference

Source Location

Signature

def normalize_embedding_endpoint(endpoint: str, *, ollama: bool = False) -> str: ...

def embedding_request_kwargs(config: Dict[str, Any]) -> Dict[str, Any]: ...

Import

from hackagent.models.embeddings import normalize_embedding_endpoint, embedding_request_kwargs

Usage Examples

Normalize an Ollama Embedding Endpoint

from hackagent.models.embeddings import normalize_embedding_endpoint

base = normalize_embedding_endpoint("http://localhost:11434", ollama=True)
print(base)  # "http://localhost:11434/v1"

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment