# d3mlab/llm-convrec architecture

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

- Interactive diagram: https://gitdiagram.com/d3mlab/llm-convrec
- Repository: https://github.com/d3mlab/llm-convrec

## Overview

LLM-ConvRec is a semi-structured conversational recommender: user input is classified into intents, recorded in explicit conversation state, mapped to recommender actions, and returned as a grounded response. Recommendations use retrieval over item reviews and metadata, with LLM prompting for query formation and explanation; state and domain-specific constraints shape the result. The README also documents restaurant location verification. Some wiring is supported only by the README or source index, so unverified links are dashed; unsampled modules are represented by their exact paths without assuming their internals.

Main entry points: [`dialogue_manager.py`](https://github.com/d3mlab/llm-convrec/blob/main/dialogue_manager.py) (Dialogue manager), [`information_retriever/information_retrieval.py`](https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/information_retrieval.py) (Information retrieval), [`rec_action/response_type/recommend_prompt_based_resp.py`](https://github.com/d3mlab/llm-convrec/blob/main/rec_action/response_type/recommend_prompt_based_resp.py) (Recommendation response), [`state/common_state_manager.py`](https://github.com/d3mlab/llm-convrec/blob/main/state/common_state_manager.py) (Conversation state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Conversation flow"]
  node_interface["User interface<br/>[user_interface.py]"]
  node_runtime["Conversation runtime<br/>[conv_rec_system.py]"]
  node_dialogue["Dialogue manager"]
  node_action_classifier["Action classifier"]
  node_actions["Response actions"]
  node_recommend_response["Recommendation response"]
  node_llm["LLM wrapper<br/>[llm_wrapper.py]"]
  node_retrieval_response["Answer response"]
end

subgraph group_memory["Intent and state"]
  node_intent_classifier["Intent classifier"]
  node_intent_types["Intent handlers"]
  node_constraint_update["Constraint updates"]
  node_state["Conversation state"]
  node_message["Message model<br/>[message.py]"]
end

subgraph group_grounding["Recommendation grounding"]
  node_retrieval["Information retrieval"]
  node_search["Review search<br/>[search_engine.py]"]
  node_vector_search["Vector search"]
  node_embedder["Text embedder<br/>[bert_embedder.py]"]
  node_vector_store[("Vector database<br/>[vector_database.py]")]
  node_item_metadata["Item metadata"]
  node_items["Recommended items"]
  node_filters["Retrieval filters<br/>[filter_applier.py]"]
end

subgraph group_domain["Domain customization"]
  node_location_filter["Location filter<br/>[location_filter.py]"]
  node_geocoder["Geocoding"]
  node_geocoder_provider["Geocoder provider"]
end

node_user(("User"))

node_user -.->|"sends input"| node_interface
node_interface -.->|"submits input"| node_runtime
node_runtime -.->|"runs conversation"| node_dialogue
node_dialogue -->|"classifies intent"| node_intent_classifier
node_dialogue -->|"updates state"| node_state
node_dialogue -->|"selects actions"| node_action_classifier
node_dialogue -->|"requests response"| node_actions
node_intent_classifier -.->|"classifies intents"| node_intent_types
node_intent_types -->|"updates constraints"| node_constraint_update
node_constraint_update -->|"updates state"| node_state
node_dialogue -->|"records turns"| node_message
node_state -->|"stores history"| node_message
node_actions -.->|"uses response"| node_recommend_response
node_recommend_response -->|"retrieves items"| node_retrieval
node_recommend_response -->|"applies filters"| node_filters
node_recommend_response -->|"requests generation"| node_llm
node_retrieval_response -.->|"uses retrieval"| node_retrieval
node_retrieval -->|"searches reviews"| node_search
node_retrieval -->|"loads item metadata"| node_item_metadata
node_retrieval -->|"creates recommendations"| node_items
node_search -->|"embeds query"| node_embedder
node_vector_search -->|"extends search"| node_search
node_vector_search -->|"queries vectors"| node_vector_store
node_location_filter -->|"checks location"| node_geocoder
node_geocoder_provider -->|"implements provider"| node_geocoder

click node_interface "https://github.com/d3mlab/llm-convrec/blob/main/user/user_interface.py"
click node_runtime "https://github.com/d3mlab/llm-convrec/blob/main/conv_rec_system.py"
click node_dialogue "https://github.com/d3mlab/llm-convrec/blob/main/dialogue_manager.py"
click node_intent_classifier "https://github.com/d3mlab/llm-convrec/blob/main/user_intent/classifiers/user_intents_classifier.py"
click node_intent_types "https://github.com/d3mlab/llm-convrec/tree/main/user_intent"
click node_constraint_update "https://github.com/d3mlab/llm-convrec/blob/main/state/constraints/one_step_constraints_updater.py"
click node_state "https://github.com/d3mlab/llm-convrec/blob/main/state/common_state_manager.py"
click node_message "https://github.com/d3mlab/llm-convrec/blob/main/state/message.py"
click node_action_classifier "https://github.com/d3mlab/llm-convrec/blob/main/rec_action/rec_actions_classifier.py"
click node_actions "https://github.com/d3mlab/llm-convrec/tree/main/rec_action"
click node_recommend_response "https://github.com/d3mlab/llm-convrec/blob/main/rec_action/response_type/recommend_prompt_based_resp.py"
click node_llm "https://github.com/d3mlab/llm-convrec/blob/main/intelligence/llm_wrapper.py"
click node_retrieval_response "https://github.com/d3mlab/llm-convrec/blob/main/rec_action/response_type/answer_prompt_based_resp.py"
click node_retrieval "https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/information_retrieval.py"
click node_search "https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/search_engine/search_engine.py"
click node_vector_search "https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/search_engine/vector_database_search_engine.py"
click node_embedder "https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/embedder/bert_embedder.py"
click node_vector_store "https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/vector_database.py"
click node_item_metadata "https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/metadata_wrapper.py"
click node_items "https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/item/recommended_item.py"
click node_filters "https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/filter/filter_applier.py"
click node_location_filter "https://github.com/d3mlab/llm-convrec/blob/main/domain_specific/classes/restaurants/location_filter.py"
click node_geocoder "https://github.com/d3mlab/llm-convrec/blob/main/domain_specific/classes/restaurants/geocoding/geocoder_wrapper.py"
click node_geocoder_provider "https://github.com/d3mlab/llm-convrec/blob/main/domain_specific/classes/restaurants/geocoding/nominatim_wrapper.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_interface,node_runtime,node_dialogue,node_action_classifier,node_actions,node_recommend_response,node_llm,node_retrieval_response,node_user toneBlue
class node_intent_classifier,node_intent_types,node_constraint_update,node_state,node_message toneAmber
class node_retrieval,node_search,node_vector_search,node_embedder,node_vector_store,node_item_metadata,node_items,node_filters toneMint
class node_location_filter,node_geocoder,node_geocoder_provider toneRose
```

## Components

### Conversation flow

- [User interface](https://github.com/d3mlab/llm-convrec/blob/main/user/user_interface.py): `user/user_interface.py`
- [Conversation runtime](https://github.com/d3mlab/llm-convrec/blob/main/conv_rec_system.py): `conv_rec_system.py`
- [Dialogue manager](https://github.com/d3mlab/llm-convrec/blob/main/dialogue_manager.py): `dialogue_manager.py`
- [Action classifier](https://github.com/d3mlab/llm-convrec/blob/main/rec_action/rec_actions_classifier.py): `rec_action/rec_actions_classifier.py`
- [Response actions](https://github.com/d3mlab/llm-convrec/tree/main/rec_action): `rec_action`
- [Recommendation response](https://github.com/d3mlab/llm-convrec/blob/main/rec_action/response_type/recommend_prompt_based_resp.py): `rec_action/response_type/recommend_prompt_based_resp.py`
- [LLM wrapper](https://github.com/d3mlab/llm-convrec/blob/main/intelligence/llm_wrapper.py): `intelligence/llm_wrapper.py`
- [Answer response](https://github.com/d3mlab/llm-convrec/blob/main/rec_action/response_type/answer_prompt_based_resp.py): `rec_action/response_type/answer_prompt_based_resp.py`

### Intent and state

- [Intent classifier](https://github.com/d3mlab/llm-convrec/blob/main/user_intent/classifiers/user_intents_classifier.py): `user_intent/classifiers/user_intents_classifier.py`
- [Intent handlers](https://github.com/d3mlab/llm-convrec/tree/main/user_intent): `user_intent`
- [Constraint updates](https://github.com/d3mlab/llm-convrec/blob/main/state/constraints/one_step_constraints_updater.py): `state/constraints/one_step_constraints_updater.py`
- [Conversation state](https://github.com/d3mlab/llm-convrec/blob/main/state/common_state_manager.py): `state/common_state_manager.py`
- [Message model](https://github.com/d3mlab/llm-convrec/blob/main/state/message.py): `state/message.py`

### Recommendation grounding

- [Information retrieval](https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/information_retrieval.py): `information_retriever/information_retrieval.py`
- [Review search](https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/search_engine/search_engine.py): `information_retriever/search_engine/search_engine.py`
- [Vector search](https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/search_engine/vector_database_search_engine.py): `information_retriever/search_engine/vector_database_search_engine.py`
- [Text embedder](https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/embedder/bert_embedder.py): `information_retriever/embedder/bert_embedder.py`
- [Vector database](https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/vector_database.py): `information_retriever/vector_database.py`
- [Item metadata](https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/metadata_wrapper.py): `information_retriever/metadata_wrapper.py`
- [Recommended items](https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/item/recommended_item.py): `information_retriever/item/recommended_item.py`
- [Retrieval filters](https://github.com/d3mlab/llm-convrec/blob/main/information_retriever/filter/filter_applier.py): `information_retriever/filter/filter_applier.py`

### Domain customization

- [Location filter](https://github.com/d3mlab/llm-convrec/blob/main/domain_specific/classes/restaurants/location_filter.py): `domain_specific/classes/restaurants/location_filter.py`
- [Geocoding](https://github.com/d3mlab/llm-convrec/blob/main/domain_specific/classes/restaurants/geocoding/geocoder_wrapper.py): `domain_specific/classes/restaurants/geocoding/geocoder_wrapper.py`
- [Geocoder provider](https://github.com/d3mlab/llm-convrec/blob/main/domain_specific/classes/restaurants/geocoding/nominatim_wrapper.py): `domain_specific/classes/restaurants/geocoding/nominatim_wrapper.py`

### Other components

- **User**

## Connections

- User → User interface: sends input
- User interface → Conversation runtime: submits input
- Conversation runtime → Dialogue manager: runs conversation
- Dialogue manager → Intent classifier: classifies intent (evidence: `dialogue_manager.py`)
- Dialogue manager → Conversation state: updates state (evidence: `dialogue_manager.py`)
- Dialogue manager → Action classifier: selects actions (evidence: `dialogue_manager.py`)
- Dialogue manager → Response actions: requests response (evidence: `dialogue_manager.py`)
- Intent classifier → Intent handlers: classifies intents (evidence: `user_intent/classifiers/user_intents_classifier.py`)
- Intent handlers → Constraint updates: updates constraints (evidence: `user_intent/provide_preference.py`)
- Constraint updates → Conversation state: updates state (evidence: `state/constraints/one_step_constraints_updater.py`)
- Dialogue manager → Message model: records turns (evidence: `dialogue_manager.py`)
- Conversation state → Message model: stores history (evidence: `state/common_state_manager.py`)
- Response actions → Recommendation response: uses response (evidence: `rec_action/response_type/recommend_prompt_based_resp.py`)
- Recommendation response → Information retrieval: retrieves items (evidence: `rec_action/response_type/recommend_prompt_based_resp.py`)
- Recommendation response → Retrieval filters: applies filters (evidence: `rec_action/response_type/recommend_prompt_based_resp.py`)
- Recommendation response → LLM wrapper: requests generation (evidence: `rec_action/response_type/recommend_prompt_based_resp.py`)
- Answer response → Information retrieval: uses retrieval
- Information retrieval → Review search: searches reviews (evidence: `information_retriever/information_retrieval.py`)
- Information retrieval → Item metadata: loads item metadata (evidence: `information_retriever/information_retrieval.py`)
- Information retrieval → Recommended items: creates recommendations (evidence: `information_retriever/information_retrieval.py`)
- Review search → Text embedder: embeds query (evidence: `information_retriever/search_engine/search_engine.py`)
- Vector search → Review search: extends search (evidence: `information_retriever/search_engine/vector_database_search_engine.py`)
- Vector search → Vector database: queries vectors (evidence: `information_retriever/search_engine/vector_database_search_engine.py`)
- Location filter → Geocoding: checks location (evidence: `domain_specific/classes/restaurants/location_filter.py`)
- Geocoder provider → Geocoding: implements provider (evidence: `domain_specific/classes/restaurants/geocoding/nominatim_wrapper.py`)
