Skip to content

feat(components): add Forge embeddings node#6469

Open
JCorners68 wants to merge 1 commit into
FlowiseAI:mainfrom
JCorners68:feat/forge-embeddings
Open

feat(components): add Forge embeddings node#6469
JCorners68 wants to merge 1 commit into
FlowiseAI:mainfrom
JCorners68:feat/forge-embeddings

Conversation

@JCorners68
Copy link
Copy Markdown

What changed

This PR adds a new Forge embeddings node to Flowise.

Changes included:

  • add a new Forge Embedding node under packages/components
  • wrap @langchain/openai OpenAIEmbeddings, since Forge exposes an OpenAI-compatible embeddings API (POST /v1/embeddings, OpenAI request/response shape)
  • pin the base URL to the Forge endpoint via configuration.baseURL = 'https://api.voxell.ai/v1'
  • reuse the existing openAIApi credential (users put their Forge API key in the OpenAI API key field — no new credential schema)
  • default modelName to forge-pro; supported models also surfaced in models.json:
    • forge-turbo (1024d)
    • forge-pro (2560d)
    • forge-ultra-4k (4096d)
  • expose the usual optional embedding parameters: stripNewLines, batchSize, timeout, dimensions, encodingFormat
  • add focused unit tests for node metadata and parameter mapping

Why this change is needed

Forge is an OpenAI-compatible embeddings provider. Today users can reach it through the OpenAI Custom Embedding node by manually overriding the base path, but there is no first-class node. This adds a small, self-contained node that follows the existing embeddings pattern (closely mirrors OpenAIEmbeddingCustom) so the endpoint, default model, and model list are preconfigured.

User impact

Users can now:

  • create embeddings with Forge directly inside Flowise without manually setting a base URL
  • pick a Forge model from the shared model list
  • configure the standard embedding options (dimensions, batchSize, etc.) without code changes

Tests / validation

Validated locally with:

  • pnpm install
  • pnpm --filter flowise-components build (tsc + gulp; icon copied to dist)
  • targeted unit tests for the new node (3 tests, all passing):
    • pnpm --filter flowise-components test -- ForgeEmbedding
  • prettier --check on the new files and models.json

Note: validation covers build and unit tests only; no live call to the Forge API was made as part of this PR.

Notes for reviewers

This PR intentionally keeps scope small:

  • no server-side changes
  • no new credential schema (reuses openAIApi)
  • no new dependencies
  • the node reuses the openAIApi credential, so the API key is entered in the OpenAI API key field — flagging since that credential-reuse UX is slightly unusual

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new ForgeEmbedding component, integrating Voxell Forge's OpenAI-compatible API to generate text embeddings. It includes the model definitions in models.json, the implementation of the ForgeEmbedding node class, unit tests, and an SVG icon. A review comment identifies an issue where setting stripNewLines to false is ignored due to a truthiness check, and suggests checking for undefined instead to correctly respect the user's preference.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

}
}

if (stripNewLines) obj.stripNewLines = stripNewLines
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

If stripNewLines is explicitly set to false by the user, the condition if (stripNewLines) will evaluate to false, and obj.stripNewLines will not be set. This causes the underlying OpenAIEmbeddings to fall back to its default value of true.

To ensure that false is respected, check if stripNewLines is not undefined instead.

Suggested change
if (stripNewLines) obj.stripNewLines = stripNewLines
if (stripNewLines !== undefined) obj.stripNewLines = stripNewLines

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