CodegenPipeline#

class ansys.cfx.mcp.common.codegen.CodegenPipeline(*, store: ansys.cfx.mcp.common.conversation.ConversationStore)#

Default pipeline: delegate to the backend.

Subclass and override generate / clarify to add LLM orchestration, retrieval, validation passes, etc.

Overview#

generate

Generate CFX Python code or a clarification response from a user prompt.

clarify

Continue code generation after a clarification answer.

Import detail#

from ansys.cfx.mcp.common.codegen import CodegenPipeline

Attribute detail#

CodegenPipeline.store#

Method detail#

async CodegenPipeline.generate(*, backend: ansys.cfx.mcp.common.backend.Backend, prompt: str, session_id: str | None = None, context: dict[str, Any] | None = None) ansys.cfx.mcp.common.models.CodegenResult#

Generate CFX Python code or a clarification response from a user prompt.

Parameters:
backendBackend

Backend that provides CFX state, validation, and execution services.

promptstr

Natural-language user request to process.

session_idOptional[str], optional

Conversation identifier used to retrieve or continue context. Default is None.

contextOptional[dict[str, Any]], optional

Additional context supplied by the caller. Default is None.

Returns:
CodegenResult

Generated-code response or clarification request.

async CodegenPipeline.clarify(*, backend: ansys.cfx.mcp.common.backend.Backend, session_id: str, clarification_id: str, answer: str) ansys.cfx.mcp.common.models.CodegenResult#

Continue code generation after a clarification answer.

Parameters:
backendBackend

Backend that provides CFX state, validation, and execution services.

session_idstr

Conversation identifier used to retrieve or continue context.

clarification_idstr

Identifier of the clarification being answered or checked.

answerstr

User answer to the clarification prompt.

Returns:
CodegenResult

Generated-code response or clarification request.