Skip to content

act no longer works on raw CBlock. #356

Description

@nrfulton

To reproduce:

from mellea.core import CBlock
from mellea.backends.ollama import OllamaModelBackend

from mellea.stdlib.context import SimpleContext
import mellea.stdlib.functional as mfuncs
from mellea.stdlib.components import SimpleComponent

backend = OllamaModelBackend(model_id="granite4:latest")
ctx = SimpleContext()

answer_1, ctx_1 = mfuncs.act(CBlock("What is 1+1?"), context=ctx, backend=backend)
answer_2, ctx_2 = mfuncs.act(CBlock("What is 2+2?"), context=ctx, backend=backend) # nb: operates on ORIGINAL context, not ctx_1.

sum_of_sums, _ = mfuncs.act(SimpleComponent(instruction="What is [x]+[y]?", x=answer_1, y=answer_2))

print(f"(1+1) + (2+2) is {sum_of_sums}"

gives error:

  File "/Users/nathan/dev/mellea/mellea/stdlib/sampling/base.py", line 177, in sample
    result.parsed_repr = action.parse(result)
                         ^^^^^^^^^^^^
AttributeError: 'CBlock' object has no attribute 'parse'

I'm also unclear why we are doing any sampling here.

Metadata

Metadata

Labels

area/backendsProvider-specific work: Ollama, HF, LiteLLM, OpenAI, Bedrock, vLLMarea/componentComponent type system, CBlock, @generative decorator, prompt templates, RichDocumentarea/stdlibCore abstractions: Context, MOT, SamplingStrategy, formatters, serializationbugSomething isn't workingp2Medium/low: minor bugs, niche features, polish, docs, tests, cleanup. Scoped, lower urgency.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions