File size: 1,103 Bytes
88e3f4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from omniff.graph.planner import GraphPlanner
from omniff.graph.visualizer import render_ascii, render_dot


def test_render_ascii():
    planner = GraphPlanner()
    graph = planner.plan("TEXT_SIMPLE")
    output = render_ascii(graph)
    assert "demux" in output
    assert "llm" in output
    assert "mux" in output


def test_render_dot():
    planner = GraphPlanner()
    graph = planner.plan("IMAGE_CAPTION")
    output = render_dot(graph)
    assert "digraph" in output
    assert "vlm" in output
    assert "->" in output


def test_render_ascii_empty():
    from omniff.graph.types import OmniGraph

    graph = OmniGraph(id="empty")
    assert render_ascii(graph) == "(empty graph)"


def test_render_dot_with_chain(tmp_path):
    from omniff.graph.chain import load_chain

    chain_file = tmp_path / "test.yaml"
    chain_file.write_text("""
id: test
nodes:
  - id: a
    type: demuxer
    config: {}
  - id: b
    type: llm_infer
    config: {}
edges:
  - from: a
    to: b
""")
    graph = load_chain(chain_file)
    dot = render_dot(graph)
    assert '"a"' in dot
    assert '"b"' in dot