# abdullahsmatrix/call_me_maybe architecture

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

- Interactive diagram: https://gitdiagram.com/abdullahsmatrix/call_me_maybe
- Repository: https://github.com/abdullahsmatrix/call_me_maybe

## Overview

call_me_maybe is a CLI that turns natural-language prompts and function definitions into structured function-call JSON. Its main workflow loads and validates those inputs, prepares a model vocabulary, then processes each prompt through an orchestrator that selects a function and fills its parameters. Constrained decoding uses grammars to restrict generated tokens; strings are usually selected from prompt spans. Results are serialized to JSON. The README documents these behaviors; unsampled implementation details are not expanded beyond that evidence.

Main entry points: [`src/__main__.py`](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/__main__.py) (Run prompts), [`src/json_loader.py`](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/json_loader.py) (JSON file I/O), [`src/orchestrator.py`](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/orchestrator.py) (Call orchestration), [`src/decoder.py`](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/decoder.py) (Constrained decoding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_args["Argument parsing"]
  node_main["Run prompts<br/>[__main__.py]"]
end

subgraph group_inputs["Input and output"]
  node_definitions["Function definitions"]
  node_prompts["Prompt input"]
  node_jsonio["JSON file I/O<br/>[json_loader.py]"]
  node_schemas["Schema validation"]
  node_parser["Input validation<br/>[json_parser.py]"]
  node_results["Call results"]
end

subgraph group_generation["Constrained generation"]
  node_orchestrator["Call orchestration<br/>[orchestrator.py]"]
  node_decoder["Constrained decoding<br/>[decoder.py]"]
  node_grammars["Value grammars<br/>[grammar.py]"]
end

subgraph group_model["Model preparation"]
  node_model{{"Qwen model"}}
  node_vocab["Vocabulary builder<br/>[vocab.py]"]
  node_cache[("Vocabulary cache<br/>[cache.json]")]
end

node_user(("CLI user"))

node_user -->|"supplies paths"| node_args
node_args -->|"provides options"| node_main
node_main -->|"loads inputs"| node_jsonio
node_definitions -->|"read by"| node_jsonio
node_prompts -->|"read by"| node_jsonio
node_main -->|"validates inputs"| node_parser
node_parser -->|"validates against"| node_schemas
node_main -->|"initializes"| node_model
node_main -->|"loads vocabulary"| node_vocab
node_vocab -->|"reads tokenizer vocab"| node_model
node_vocab -->|"reads or writes"| node_cache
node_main -->|"processes prompts"| node_orchestrator
node_orchestrator -->|"generates values"| node_decoder
node_decoder -->|"queries legal tokens"| node_grammars
node_decoder -->|"gets logits"| node_model
node_orchestrator -->|"encodes and scores"| node_model
node_main -->|"writes results"| node_jsonio
node_jsonio -->|"serializes calls"| node_results

click node_args "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/arguement_parser.py"
click node_main "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/__main__.py"
click node_definitions "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/data/input/functions_definition.json"
click node_prompts "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/data/input/function_calling_tests.json"
click node_jsonio "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/json_loader.py"
click node_schemas "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/validation_models.py"
click node_parser "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/json_parser.py"
click node_orchestrator "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/orchestrator.py"
click node_decoder "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/decoder.py"
click node_grammars "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/grammar.py"
click node_vocab "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/vocab.py"
click node_cache "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/data/cache/cache.json"
click node_results "https://github.com/abdullahsmatrix/call_me_maybe/blob/main/data/output/function_calling_results.json"

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_args,node_main,node_user toneBlue
class node_definitions,node_prompts,node_jsonio,node_schemas,node_parser,node_results toneAmber
class node_orchestrator,node_decoder,node_grammars toneMint
class node_model,node_vocab,node_cache toneRose
```

## Components

### CLI workflow

- [Argument parsing](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/arguement_parser.py): `src/arguement_parser.py`
- [Run prompts](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/__main__.py): `src/__main__.py`

### Input and output

- [Function definitions](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/data/input/functions_definition.json): `data/input/functions_definition.json`
- [Prompt input](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/data/input/function_calling_tests.json): `data/input/function_calling_tests.json`
- [JSON file I/O](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/json_loader.py): `src/json_loader.py`
- [Schema validation](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/validation_models.py): `src/validation_models.py`
- [Input validation](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/json_parser.py): `src/json_parser.py`
- [Call results](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/data/output/function_calling_results.json): `data/output/function_calling_results.json`

### Constrained generation

- [Call orchestration](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/orchestrator.py): `src/orchestrator.py`
- [Constrained decoding](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/decoder.py): `src/decoder.py`
- [Value grammars](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/grammar.py): `src/grammar.py`

### Model preparation

- **Qwen model**
- [Vocabulary builder](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/src/vocab.py): `src/vocab.py`
- [Vocabulary cache](https://github.com/abdullahsmatrix/call_me_maybe/blob/main/data/cache/cache.json): `data/cache/cache.json`

### Other components

- **CLI user**

## Connections

- CLI user → Argument parsing: supplies paths
- Argument parsing → Run prompts: provides options (evidence: `src/__main__.py`)
- Run prompts → JSON file I/O: loads inputs (evidence: `src/__main__.py`)
- Function definitions → JSON file I/O: read by
- Prompt input → JSON file I/O: read by
- Run prompts → Input validation: validates inputs (evidence: `src/__main__.py`)
- Input validation → Schema validation: validates against (evidence: `src/json_parser.py`)
- Run prompts → Qwen model: initializes (evidence: `src/__main__.py`)
- Run prompts → Vocabulary builder: loads vocabulary (evidence: `src/__main__.py`)
- Vocabulary builder → Qwen model: reads tokenizer vocab (evidence: `src/vocab.py`)
- Vocabulary builder → Vocabulary cache: reads or writes (evidence: `src/vocab.py`)
- Run prompts → Call orchestration: processes prompts (evidence: `src/__main__.py`)
- Call orchestration → Constrained decoding: generates values (evidence: `src/orchestrator.py`)
- Constrained decoding → Value grammars: queries legal tokens (evidence: `src/decoder.py`)
- Constrained decoding → Qwen model: gets logits (evidence: `src/decoder.py`)
- Call orchestration → Qwen model: encodes and scores (evidence: `src/orchestrator.py`)
- Run prompts → JSON file I/O: writes results (evidence: `src/__main__.py`)
- JSON file I/O → Call results: serializes calls (evidence: `src/json_loader.py`)
