# hasanazeerkhan/ai-chatbot-testing architecture

> Architecture diagram of the GitHub repository hasanazeerkhan/ai-chatbot-testing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hasanazeerkhan/ai-chatbot-testing
- Repository: https://github.com/hasanazeerkhan/ai-chatbot-testing

## Overview

This repository is an AI-chatbot testing framework: test scenarios exercise local LLM responses, with direct assertions for some behaviors and an LLM judge plus schema validation for answer quality. The graph preserves its documented functional, conversation, hallucination, safety, and injection coverage. Test-suite internals were not sampled, so their connections are limited to relationships documented in the README.

Main entry points: [`src/clients/ollamaClient.js`](https://github.com/hasanazeerkhan/ai-chatbot-testing/blob/master/src/clients/ollamaClient.js) (Ollama client), [`tests/functional`](https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/tests/functional) (Functional tests), [`test-data`](https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/test-data) (Scenario data), [`tests/hallucination`](https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/tests/hallucination) (Hallucination tests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scenarios["Test scenarios"]
  node_functional["Functional tests"]
  node_conversation["Conversation tests"]
  node_hallucination["Hallucination tests"]
  node_safety["Safety tests"]
  node_injection["Injection tests"]
  node_testdata["Scenario data"]
end

subgraph group_runtime["Chatbot runtime"]
  node_chatbot["Chatbot entry<br/>[chatbot.js]"]
  node_ollama_client["Ollama client<br/>[ollamaClient.js]"]
end

subgraph group_evaluation["Response evaluation"]
  node_evaluator["LLM evaluator<br/>[evaluator.js]"]
  node_parser["Response parser<br/>[responseParser.js]"]
  node_schema["Evaluation schema<br/>[schemas.js]"]
end

node_tester(("Test runner"))
node_ollama{{"Ollama / Llama 3.2"}}

node_tester -->|"runs"| node_functional
node_tester -->|"runs"| node_conversation
node_tester -->|"runs"| node_hallucination
node_tester -->|"runs"| node_safety
node_tester -->|"runs"| node_injection
node_functional -->|"uses scenarios"| node_testdata
node_hallucination -->|"uses scenarios"| node_testdata
node_safety -->|"uses scenarios"| node_testdata
node_injection -->|"uses scenarios"| node_testdata
node_functional -->|"requests response"| node_ollama_client
node_conversation -->|"requests turns"| node_ollama_client
node_hallucination -->|"requests response"| node_ollama_client
node_safety -->|"requests response"| node_ollama_client
node_injection -->|"requests response"| node_ollama_client
node_ollama_client -->|"sends chat"| node_ollama
node_chatbot -->|"sends chat"| node_ollama
node_functional -->|"judges answer"| node_evaluator
node_evaluator -->|"requests judgment"| node_ollama
node_evaluator -->|"validates result"| node_schema

click node_functional "https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/tests/functional"
click node_conversation "https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/tests/conversation"
click node_hallucination "https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/tests/hallucination"
click node_safety "https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/tests/safety"
click node_injection "https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/tests/prompt-injection"
click node_testdata "https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/test-data"
click node_chatbot "https://github.com/hasanazeerkhan/ai-chatbot-testing/blob/master/src/chatbot.js"
click node_ollama_client "https://github.com/hasanazeerkhan/ai-chatbot-testing/blob/master/src/clients/ollamaClient.js"
click node_evaluator "https://github.com/hasanazeerkhan/ai-chatbot-testing/blob/master/src/evaluation/evaluator.js"
click node_parser "https://github.com/hasanazeerkhan/ai-chatbot-testing/blob/master/src/utils/responseParser.js"
click node_schema "https://github.com/hasanazeerkhan/ai-chatbot-testing/blob/master/src/evaluation/schemas.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_functional,node_conversation,node_hallucination,node_safety,node_injection,node_testdata toneBlue
class node_chatbot,node_ollama_client toneAmber
class node_evaluator,node_parser,node_schema toneMint
class node_tester,node_ollama toneIndigo
```

## Components

### Test scenarios

- [Functional tests](https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/tests/functional): `tests/functional`
- [Conversation tests](https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/tests/conversation): `tests/conversation`
- [Hallucination tests](https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/tests/hallucination): `tests/hallucination`
- [Safety tests](https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/tests/safety): `tests/safety`
- [Injection tests](https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/tests/prompt-injection): `tests/prompt-injection`
- [Scenario data](https://github.com/hasanazeerkhan/ai-chatbot-testing/tree/master/test-data): `test-data`

### Chatbot runtime

- [Chatbot entry](https://github.com/hasanazeerkhan/ai-chatbot-testing/blob/master/src/chatbot.js): `src/chatbot.js`
- [Ollama client](https://github.com/hasanazeerkhan/ai-chatbot-testing/blob/master/src/clients/ollamaClient.js): `src/clients/ollamaClient.js`

### Response evaluation

- [LLM evaluator](https://github.com/hasanazeerkhan/ai-chatbot-testing/blob/master/src/evaluation/evaluator.js): `src/evaluation/evaluator.js`
- [Response parser](https://github.com/hasanazeerkhan/ai-chatbot-testing/blob/master/src/utils/responseParser.js): `src/utils/responseParser.js`
- [Evaluation schema](https://github.com/hasanazeerkhan/ai-chatbot-testing/blob/master/src/evaluation/schemas.js): `src/evaluation/schemas.js`

### Other components

- **Test runner**
- **Ollama / Llama 3.2**

## Connections

- Test runner → Functional tests: runs (evidence: `README.md`)
- Test runner → Conversation tests: runs (evidence: `README.md`)
- Test runner → Hallucination tests: runs (evidence: `README.md`)
- Test runner → Safety tests: runs (evidence: `README.md`)
- Test runner → Injection tests: runs (evidence: `README.md`)
- Functional tests → Scenario data: uses scenarios (evidence: `README.md`)
- Hallucination tests → Scenario data: uses scenarios (evidence: `README.md`)
- Safety tests → Scenario data: uses scenarios (evidence: `README.md`)
- Injection tests → Scenario data: uses scenarios (evidence: `README.md`)
- Functional tests → Ollama client: requests response (evidence: `README.md`)
- Conversation tests → Ollama client: requests turns (evidence: `README.md`)
- Hallucination tests → Ollama client: requests response (evidence: `README.md`)
- Safety tests → Ollama client: requests response (evidence: `README.md`)
- Injection tests → Ollama client: requests response (evidence: `README.md`)
- Ollama client → Ollama / Llama 3.2: sends chat (evidence: `src/clients/ollamaClient.js`)
- Chatbot entry → Ollama / Llama 3.2: sends chat (evidence: `src/chatbot.js`)
- Functional tests → LLM evaluator: judges answer (evidence: `README.md`)
- LLM evaluator → Ollama / Llama 3.2: requests judgment (evidence: `src/evaluation/evaluator.js`)
- LLM evaluator → Evaluation schema: validates result (evidence: `src/evaluation/evaluator.js`)
