# ayfadli/call-me-maybe architecture

> Architecture diagram of the GitHub repository ayfadli/call-me-maybe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ayfadli/call-me-maybe
- Repository: https://github.com/ayfadli/call-me-maybe

## Overview

Call Me Maybe is a CLI tool that turns prompts and function schemas into constrained JSON function calls. Its main workflow loads both input files, prepares a local language model and token masks, generates each call through constrained decoding, validates and normalizes the result, then writes a JSON results file. The README also describes schema-guided prompting and token-level filtering. The graph follows the sampled CLI, decoder and SDK code; output behavior is documented, while no output file is present in the tree.

Main entry points: [`src/__main__.py`](https://github.com/ayfadli/call-me-maybe/blob/main/src/__main__.py) (CLI orchestration), [`llm_sdk/llm_sdk/__init__.py`](https://github.com/ayfadli/call-me-maybe/blob/main/llm_sdk/llm_sdk/__init__.py) (LLM SDK), [`src/vocab_parser.py`](https://github.com/ayfadli/call-me-maybe/blob/main/src/vocab_parser.py) (Constrained generation), [`data/input/functions_definition.json`](https://github.com/ayfadli/call-me-maybe/blob/main/data/input/functions_definition.json) (Function definitions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["CLI workflow"]
  node_cli["CLI orchestration<br/>[__main__.py]"]
  node_schemas["Function definitions"]
  node_prompts["Test prompts"]
  node_cache["Mask preparation<br/>[__main__.py]"]
  node_validation["Result validation<br/>[__main__.py]"]
  node_output["Results JSON"]
end

subgraph group_decoding["Constrained decoding"]
  node_decoder["Constrained generation<br/>[vocab_parser.py]"]
end

subgraph group_inference["Model inference"]
  node_sdk["LLM SDK<br/>[__init__.py]"]
  node_model["Language model"]
end

node_user(("CLI user"))
node_hub["Hugging Face Hub"]

node_user -->|"runs"| node_cli
node_cli -->|"loads"| node_schemas
node_cli -->|"loads"| node_prompts
node_cli -->|"initializes"| node_sdk
node_cli -->|"prepares masks"| node_cache
node_cli -->|"invokes"| node_decoder
node_cache -->|"derives constraints"| node_schemas
node_decoder -->|"requests logits"| node_sdk
node_sdk -->|"runs inference"| node_model
node_sdk -->|"downloads vocabulary"| node_hub
node_cli -->|"validates results"| node_validation
node_validation -->|"writes"| node_output

click node_cli "https://github.com/ayfadli/call-me-maybe/blob/main/src/__main__.py"
click node_schemas "https://github.com/ayfadli/call-me-maybe/blob/main/data/input/functions_definition.json"
click node_prompts "https://github.com/ayfadli/call-me-maybe/blob/main/data/input/function_calling_tests.json"
click node_cache "https://github.com/ayfadli/call-me-maybe/blob/main/src/__main__.py"
click node_decoder "https://github.com/ayfadli/call-me-maybe/blob/main/src/vocab_parser.py"
click node_sdk "https://github.com/ayfadli/call-me-maybe/blob/main/llm_sdk/llm_sdk/__init__.py"
click node_validation "https://github.com/ayfadli/call-me-maybe/blob/main/src/__main__.py"

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_cli,node_schemas,node_prompts,node_cache,node_validation,node_output,node_user toneBlue
class node_decoder toneAmber
class node_sdk,node_model toneMint
class node_hub toneIndigo
```

## Components

### CLI workflow

- [CLI orchestration](https://github.com/ayfadli/call-me-maybe/blob/main/src/__main__.py): `src/__main__.py`
- [Function definitions](https://github.com/ayfadli/call-me-maybe/blob/main/data/input/functions_definition.json): `data/input/functions_definition.json`
- [Test prompts](https://github.com/ayfadli/call-me-maybe/blob/main/data/input/function_calling_tests.json): `data/input/function_calling_tests.json`
- [Mask preparation](https://github.com/ayfadli/call-me-maybe/blob/main/src/__main__.py): `src/__main__.py`
- [Result validation](https://github.com/ayfadli/call-me-maybe/blob/main/src/__main__.py): `src/__main__.py`
- **Results JSON**

### Constrained decoding

- [Constrained generation](https://github.com/ayfadli/call-me-maybe/blob/main/src/vocab_parser.py): `src/vocab_parser.py`

### Model inference

- [LLM SDK](https://github.com/ayfadli/call-me-maybe/blob/main/llm_sdk/llm_sdk/__init__.py): `llm_sdk/llm_sdk/__init__.py`
- **Language model**

### Other components

- **CLI user**
- **Hugging Face Hub**

## Connections

- CLI user → CLI orchestration: runs (evidence: `README.md`)
- CLI orchestration → Function definitions: loads (evidence: `src/__main__.py`)
- CLI orchestration → Test prompts: loads (evidence: `src/__main__.py`)
- CLI orchestration → LLM SDK: initializes (evidence: `src/__main__.py`)
- CLI orchestration → Mask preparation: prepares masks (evidence: `src/__main__.py`)
- CLI orchestration → Constrained generation: invokes (evidence: `src/__main__.py`)
- Mask preparation → Function definitions: derives constraints (evidence: `src/__main__.py`)
- Constrained generation → LLM SDK: requests logits (evidence: `src/vocab_parser.py`)
- LLM SDK → Language model: runs inference (evidence: `llm_sdk/llm_sdk/__init__.py`)
- LLM SDK → Hugging Face Hub: downloads vocabulary (evidence: `llm_sdk/llm_sdk/__init__.py`)
- CLI orchestration → Result validation: validates results (evidence: `src/__main__.py`)
- Result validation → Results JSON: writes (evidence: `src/__main__.py`)
