File size: 4,992 Bytes
095a131
79ba0cd
 
095a131
050d069
095a131
 
 
 
 
050d069
095a131
 
 
44b9746
095a131
 
 
f5038e4
095a131
c6c68c5
095a131
44b9746
 
 
 
 
095a131
44b9746
 
095a131
 
 
 
 
 
 
79ba0cd
095a131
 
 
 
 
79ba0cd
 
095a131
44b9746
 
 
 
 
095a131
44b9746
79ba0cd
 
095a131
44b9746
 
 
 
 
095a131
5402d17
79ba0cd
 
095a131
44b9746
 
 
 
 
095a131
44b9746
095a131
 
 
 
 
c6c68c5
095a131
 
 
79ba0cd
095a131
 
44b9746
095a131
 
 
 
050d069
 
 
 
 
 
 
095a131
79ba0cd
f5038e4
5402d17
050d069
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
orchestrator:
  id: orka-ui
  strategy: decision-tree
  queue: orka:generated
  memory_preset: "semantic"  # Use semantic memory for knowledge processing
  agents:
    - memory-reader
    - memory-check
    - router
    - memory-writer
    - final_summary
agents:
  - id: memory-reader
    type: memory
    memory_preset: "semantic"  # Facts and knowledge base (30 days)
    queue: orka:memory-reader
    config:
      operation: read
      memory_category_filter: stored
    namespace: landmarks
    prompt: Retrieve any stored memories about {{ get_input() }}. Return "NONE" if nothing matches.
  - id: memory-check
    type: local_llm
    model: gpt-oss:20b
    model_url: http://localhost:11434/api/generate
    provider: ollama
    temperature: 0.1
    queue: orka:memory-check
    prompt: |
      'Check if the following memory data is relevant to the question and has high confidence. Question: {{ get_input() }} Memory: {{ get_agent_response(''memory-reader'') }} Return true if: 1) The memory contains relevant information about the question; 2) The memory has a confidence score higher than 0.89; 3) The memory is not "NONE". Return false otherwise. Answer with exactly ''true'' or ''false'' only.'
  - id: router
    type: router
    params:
      decision_key: memory-check
      routing_map:
        "true":
          - memory-path
          - memory-writer
        "false":
          - context-collector
          - answer-builder
          - validation-guard
          - memory-writer
    depends_on:
      - memory-check
  - id: memory-path
    type: local_llm
    model: gpt-oss:20b
    model_url: http://localhost:11434/api/generate
    provider: ollama
    temperature: 0.3
    queue: orka:memory-path
    prompt: Format the stored memory information about the {{ get_input() }} into a clear answer:{{ get_agent_response('memory-reader') if get_agent_response('memory-reader') else 'NONE' }}. Provide a well-structured response.
    depends_on:
      - router
  - id: context-collector
    type: local_llm
    model: gpt-oss:20b
    model_url: http://localhost:11434/api/generate
    provider: ollama
    temperature: 0.5
    queue: orka:context-collector
    prompt: Based on the question "{{ get_input() }}", collect relevant context and background information. Focus on gathering factual information that will help validate the answer. If no specific information is available, explain what type of information would be needed and suggest research directions. Do not return just "NONE" - provide a meaningful response about the information availability.
    depends_on:
      - router
  - id: answer-builder
    type: local_llm
    model: gpt-oss:20b
    model_url: http://localhost:11434/api/generate
    provider: ollama
    temperature: 0.7
    queue: orka:answer-builder
    prompt: "Using the context: {{ get_agent_response('context-collector') }} Provide a detailed answer to: {{ get_input() }}. If the context indicates no information is available, explain what is known and what would need to be researched. Do not return just 'NONE'. Be comprehensive and helpful."
    depends_on:
      - context-collector
  - id: validation-guard
    type: validate_and_structure
    queue: orka:validation-guard
    prompt: "Validate the answer and structure it into a memory format. Question: {{ get_input() }} Answer to validate: {{ get_agent_response('answer-builder') }}"
    depends_on:
      - answer-builder
      - context-collector
    store_structure: '{  "fact": "string",  "reason": "string",  "confidence": "number",  "source": "string"}'
  - id: memory-writer
    type: memory
    memory_preset: "semantic"  # Facts and knowledge base (30 days)
    queue: orka:memory-writer
    config:
      operation: write
    namespace: landmarks
    prompt: |
      {% set validation_result = get_agent_response('validation-guard') %}
      {% if validation_result %}
      {{ validation_result }}
      {% else %}
      Store information about: {{ get_input() }}
      {% endif %}
    metadata:
      source: validation-guard
      category: "stored"
    key_template: "{{ get_input() }}"
    
  - id: final_summary
    type: local_llm
    model: gpt-oss:20b
    model_url: http://localhost:11434/api/generate
    provider: ollama
    temperature: 0.7
    prompt: |
      Answer this question: "{{ get_input() }}"
      
      {% set memory_path_result = get_agent_response('memory-path') %}
      {% set answer_result = get_agent_response('answer-builder') %}
      {% set validation_result = get_agent_response('validation-guard') %}
      
      {% if memory_path_result %}
      {{ memory_path_result }}
      {% elif answer_result %}
      {{ answer_result }}
      {% else %}
      Let me provide the best answer I can based on the available information.
      {% endif %}
      
      {% if validation_result %}
      
      Additional validation: {{ validation_result }}
      {% endif %}
      
      Provide a thorough, accurate response to the user's question.