diff --git a/bindings/ceylon/examples/llm/app.py b/bindings/ceylon/examples/llm/process_llm_app.py similarity index 94% rename from bindings/ceylon/examples/llm/app.py rename to bindings/ceylon/examples/llm/process_llm_app.py index 655c0da..0482e68 100644 --- a/bindings/ceylon/examples/llm/app.py +++ b/bindings/ceylon/examples/llm/process_llm_app.py @@ -2,7 +2,7 @@ from ceylon.llm.agent import LLMConfig, LLMAgent from ceylon.llm.models.ollama import OllamaModel -from ceylon.processor.agent import ProcessWorker, ProcessRequest, ProcessResponse +from ceylon.processor.agent import ProcessRequest, ProcessResponse from ceylon.processor.playground import ProcessPlayGround @@ -46,3 +46,4 @@ async def main(): if __name__ == "__main__": asyncio.run(main()) + diff --git a/bindings/ceylon/examples/llm/task_llm_app.py b/bindings/ceylon/examples/llm/task_llm_app.py new file mode 100644 index 0000000..2be90dd --- /dev/null +++ b/bindings/ceylon/examples/llm/task_llm_app.py @@ -0,0 +1,52 @@ +import asyncio + +from ceylon.llm.agent import LLMConfig, LLMAgent +from ceylon.llm.models.ollama import OllamaModel +from ceylon.processor.agent import ProcessRequest, ProcessResponse +from ceylon.processor.playground import ProcessPlayGround +from ceylon.task.data import Task, TaskResult +from ceylon.task.playground import TaskProcessingPlayground + + +async def main(): + # Create playground and worker + playground = TaskProcessingPlayground() + llm_model = OllamaModel( + model_name="deepseek-r1:8b", + base_url="http://localhost:11434" + ) + + # Configure LLM agent + llm_config = LLMConfig( + system_prompt=( + "You are an expert content writer specializing in technology topics. " + ), + temperature=0.7, + max_tokens=1000, + retry_attempts=1 + ) + + # Create LLM agent + llm_agent = LLMAgent( + name="writer_1", + llm_model=llm_model, + config=llm_config, + role="writer" + ) + + # Start the system + async with playground.play(workers=[llm_agent]) as active_playground: + active_playground: TaskProcessingPlayground = active_playground + # Send some test requests + response: TaskResult = await active_playground.add_and_execute_task( + Task( + name="Process Data 1", + processor="writer", + input_data={"request": "A Simple title for a blog post about AI"} + ) + ) + print(f"Response received: {response.output}") + + +if __name__ == "__main__": + asyncio.run(main())