ReMe/reme_ai/react/simple_react_op.py
jinli.yl 49c73b15b3 refactor(reme_ai): update app and ops for async execution and new LLM features
- Update app.py to use async service initialization
- Refactor multiple ops to use async_execute instead of execute
- Add support for stream and use_async flags in config
- Update LLM usage to use achat instead of chat
- Add new LLM models and update existing ones in config
- Improve error handling and logging in several ops
- Update dependencies and Python version requirements
2025-09-06 20:17:33 +08:00

24 lines
608 B
Python

import asyncio
from flowllm import C
from flowllm.context.flow_context import FlowContext
from flowllm.op.llm.react_llm_op import ReactLLMOp
@C.register_op()
class SimpleReactOp(ReactLLMOp):
...
async def main():
from reme_ai.config.config_parser import ConfigParser
C.set_service_config(parser=ConfigParser, config_name="config=default").init_by_service_config()
context = FlowContext(query="茅台和五粮现在股价多少?")
op = SimpleReactOp()
await op.async_call(context=context)
print(context.response.answer)
if __name__ == "__main__":
asyncio.run(main())