Nodes/comfyui_LLM_party/☁️OpenAI Embeddings database Tool
ComfyUI Node

☁️OpenAI Embeddings database Tool

Give your agent a RAG tool without a local model

By heshengtao·Created 2 years ago·Updated 7 days ago· 2,321
☁️OpenAI Embeddings database Tool
    • tool
    model_nametext-embedding-3-small
    is_enabletrue
    k5
    chunk_size200
    chunk_overlap50
    file_content
    base_path
    base_url
    api_key
    is_ollamafalse

    This is comfyui_LLM_party's cloud-backed version of retrieval-augmented generation as an agent tool. The mechanism is the standard RAG recipe: chop your document into chunks, turn each chunk into a vector with an embedding model, and at query time pull back whichever chunks are closest to what's being asked, so the LLM can reference real text instead of guessing. What's specific to this node is that the embedding step happens over the OpenAI API rather than a model running on your own GPU - trading your VRAM for API spend, and skipping the need to have an embedding model on disk at all.

    How it works

    Wire the tool output into an LLM/agent node's tool-list input. Once it's connected, the model can decide mid-conversation to query your knowledge base itself, rather than you manually retrieving and pasting context into the prompt beforehand.

    The inputs and outputs that matter

    • model_name (default text-embedding-3-small) - OpenAI's cheap, fast embedding model; swap it for a larger one if you need better retrieval precision and don't mind the cost.
    • k (default 5) - how many top-matching chunks come back per query. Higher means more context handed to the LLM, but also a longer prompt and a higher chance of pulling in something less relevant.
    • chunk_size / chunk_overlap (200 / 50) - how source text gets split before embedding. Smaller chunks retrieve more precisely but carry less surrounding context; the overlap keeps an idea that straddles a chunk boundary from getting cut in half.
    • file_content (optional) - the text to index, typically piped in from one of this pack's loader nodes rather than typed by hand.
    • base_path (optional) - point at a folder instead of a single blob of text.
    • base_url / api_key - optional, falls back to config.ini if left blank.
    • is_ollama (default false) - flip this on and the node talks to a local Ollama embeddings endpoint through the same OpenAI-compatible interface, instead of the real cloud API. Same trick this pack uses elsewhere to swap "cloud" for "local" without changing anything else about how a node is called.

    One output: tool (STRING) - wire it into your agent's tools input.

    How to install it

    • ComfyUI Manager: search "comfyui_LLM_party", install, restart.
    • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/heshengtao/comfyui_LLM_party, then pip install -r requirements.txt from inside the pack folder using ComfyUI's own Python, then restart.

    No local embedding model, no GPU allocation for this node specifically - just working API credentials, or a running local Ollama instance if you're using is_ollama.

    Common issues & troubleshooting

    It fails before touching your document at all. Check credentials first - an empty or invalid api_key/base_url (or an unfilled config.ini) fails at the very first embedding call, before any chunking happens.

    API costs climb faster than expected. Every chunk is a separate embedding call - a large document with a small chunk_size means a lot of requests. If you're indexing something big, consider a coarser chunk_size or check your provider's per-call pricing first.

    Retrieval feels off - the LLM keeps citing the wrong parts of your document. That traces back to chunk_size/chunk_overlap, not this node's connection to the API. Chunks too large blur separate topics together; too small, and you lose the surrounding context needed to match a query meaningfully.

    Category大模型派对(llm_party)/工具(tools)/知识库(Knowbase)

    Inputs (10)

    NameTypeDefaultDescription
    model_nameSTRINGtext-embedding-3-small
    is_enableBOOLEANtrue
    kINT5
    chunk_sizeINT200
    chunk_overlapINT50
    file_contentoptSTRING
    base_pathoptSTRING
    base_urloptSTRING
    api_keyoptSTRING
    is_ollamaoptBOOLEANfalse

    Outputs (1)

    NameTypeDescription
    toolSTRING