Run ComfyUI Easily with InstaSD
Skip the complex setup and run ComfyUI online. InstaSD helps creative professionals build workflows and deploy them to the world:
- One-click deployment
- Any model, any node
- Powerful GPUs for rapid iteration
Available Nodes
OllamaGenerateV2
OllamaGenerateV2 Node Documentation
Introduction
The OllamaGenerateV2 node is a component within the ComfyUI Ollama integration, which allows users to interact with Large Language Models (LLMs) hosted by an Ollama server. It facilitates the generation of textual content based on prompts and system inputs, thereby supporting the creation of creative and informative workflows within the ComfyUI environment.
What This Node Does
The OllamaGenerateV2 node serves as a more modular and controllable method to interact with LLMs. It enables users to set a system prompt and the main prompt to generate text outputs. This node also supports saving the processing context for reuse, making it suitable for building more complex, chained workflows.
Inputs
The OllamaGenerateV2 node accepts several inputs, which are categorized as either required or optional:
Required Inputs
- System: A string input serving as the system-level prompt. It can be set to guide the LLM's behavior, such as defining the role it plays (e.g., "You are an AI artist").
- Prompt: A string input that specifies the main query or command sent to the LLM (e.g., "What is art?").
- Filter Thinking: A boolean input that, when enabled, filters out any 'thinking' tags from the response generated by the LLM.
- Keep Context: A boolean input that determines whether the context of the current session should be saved and preserved for future interactions.
- Format: A dropdown menu option to choose the format of the response, either 'text' or 'json'.
Optional Inputs
- Connectivity: This input provides connectivity information to the Ollama server, including host URL, model, and keep-alive settings.
- Options: Additional options for controlling various parameters of the LLM API, such as temperature or top-k settings.
- Images: Allows users to input images if the node is configured to process visual content alongside text.
- Context: An input for providing previously saved context, enabling the continuation of a session.
- Meta: A metadata input that carries contextual and connection settings from previous nodes in the workflow.
Note: Either the Connectivity input or the Meta input is required for the node to function properly. If multiple nodes share context and images, they must be passed in the Meta input.
Outputs
- Result: The text generated by the LLM in response to the input prompt.
- Context: A string representing the context from the current interaction, which can be reused in subsequent processes.
- Meta: Metadata that includes options and connectivity settings, allowing other nodes to inherit these settings without redefinition.
Usage in ComfyUI Workflows
The OllamaGenerateV2 node can be incorporated into ComfyUI workflows to perform various text generation tasks. It is particularly useful in scenarios where multiple nodes must share context or continue an iterative discussion with the LLM over several stages.
Example Workflow
- Connect to Ollama Server: Use the
OllamaConnectivityV2node to establish a connection with the server. - Set Options: Define any LLM-specific parameters using the
OllamaOptionsV2node. - Generate Text: Add the
OllamaGenerateV2node, input the system prompt and main prompt, and connect it to the connectivity and options nodes. - Chain Results: Use the context output to feed subsequent
OllamaGeneratenodes, enabling ongoing interaction with preserved session context.
Special Features and Considerations
- Context Preservation: The
Keep Contextfeature supports building complex workflows by allowing sessions to retain memory across multiple operations. - Meta Handling: The ability to pass metadata between nodes helps encapsulate connectivity and options, simplifying workflow management.
- Flexible Input Handling: Optional inputs such as images and context allow for versatile use cases, including image processing and session continuation.
- Debugging: While not exposed in the node's user interface, enabling debugging via options can be useful for troubleshooting and understanding the flow of data through the node.
In summary, OllamaGenerateV2 provides advanced capabilities for integrating and leveraging the power of LLMs within ComfyUI workflows, making it a pivotal node for users seeking both creative and analytical text generation solutions.