image.domain\agent_kit\agent_kit.mbt

100% · 10 / 10 points · 41 lines

Background color reports the state of each line. Underlined characters mark exact instrumented byte offsets; hover them to inspect the visit count.

  1. 1///|
  2. 2/// # Agent 工具包 Agent Kit
  3. 3///
  4. 4/// 智能体集成工具包
  5. 5/// 描述 Agent integration toolkit
  6. 6// Agent-Kit 高层 API — 自然语言图像处理
  7. 7// nl_process: "给这张图去噪并检测边缘" → 引擎原生算子执行
  8. 8
  9. 9///|
  10. 10pub fn nl_process(
  11. 11 image : @types.Image,
  12. 12 query : String,
  13. 13) -> @types.Image raise @types.LoadError {
  14. 14● let pipeline = nl_to_pipeline(query)
  15. 15● let result = @imgir.ir_execute(pipeline, @imgir.IRValue::VImage(image))
  16. 16● result.as_image()
  17. 17}
  18. 18
  19. 19///|
  20. 20pub fn nl_process_value(
  21. 21 value : @imgir.IRValue,
  22. 22 query : String,
  23. 23) -> @imgir.IRValue raise @types.LoadError {
  24. 24● let pipeline = nl_to_pipeline(query)
  25. 25● @imgir.ir_execute(pipeline, value)
  26. 26}
  27. 27
  28. 28///|
  29. 29pub fn nl_preview(query : String) -> String {
  30. 30● nl_to_description(query)
  31. 31}
  32. 32
  33. 33///|
  34. 34pub fn nl_intents(query : String) -> Array[Intent] {
  35. 35● nl_parse(query)
  36. 36}
  37. 37
  38. 38///|
  39. 39pub fn nl_pipeline(query : String) -> @imgir.IRPipeline {
  40. 40● nl_to_pipeline(query)
  41. 41}