Find answers from the community

Updated 3 months ago

This trivial workflow isn't working;

Edit: fix is to upgrade to newer version.

This trivial workflow isn't working; fails with llama_index.core.workflow.errors.WorkflowValidationError: The following events are consumed but never produced: {<class 'llama_index.core.workflow.events.StopEvent'>}

Note that workflows with 2+ steps fail the same way too.

llama-index==0.10.59
llama-index-core==0.10.59
Plain Text
from llama_index.core.workflow import (
    StartEvent,
    StopEvent,
    Workflow,
    step,
    Event,
)
import asyncio

class QueryEvent(Event):
    query: str

class TrivialFlow(Workflow):
    @step
    async def query(self, ev: StartEvent) -> StopEvent:
        result = f"The answer to your query <{ev.query}> is 42."
        return StopEvent(result=result)
    
async def get_result():
    g = TrivialFlow(timeout=10, verbose=True)
    result = await g.run(query="What's LlamaIndex?")
    print(result)
    
if __name__ == "__main__":
    asyncio.run(get_result())
L
c
4 comments
Likely a buggy release at the time
I have dependencies requiring <11, but version 0.10.68 had this fixed.
Great! πŸ™‚
Add a reply
Sign up and join the conversation on Discord