Skip to content

Commit

Permalink
feat: add mkdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
PeriniM committed Oct 7, 2024
1 parent 25dff8b commit d38421e
Show file tree
Hide file tree
Showing 37 changed files with 391 additions and 3 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy documentation to GitHub Pages

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install --no-root
- name: Build documentation
run: |
poetry run mkdocs build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="docs/assets/brickllm_logo2.png" alt="BrickLLM" style="width: 100%;">
<img src="docs/assets/brickllm_banner.png" alt="BrickLLM" style="width: 100%;">
</p>

# 🧱 BrickLLM
Expand Down
7 changes: 5 additions & 2 deletions brickllm/graphs/brickschema_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,11 @@ def run(self, prompt, stream=False):
"""Run the graph with the given user prompt.
Args:
user_prompt (str): The user-provided natural language prompt.
stream (bool): Whether to stream the execution (True) or run without streaming (False).
prompt (str): The user prompt to run the graph.
stream (bool): Stream the graph execution.
Returns:
result (dict): The result of the graph execution.
"""
input_data = {"user_prompt": prompt}

Expand Down
File renamed without changes
Binary file modified docs/assets/brickllm_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Welcome to BrickLLM

BrickLLM is a Python library designed to generate RDF files that comply with the BrickSchema ontology using Large Language Models (LLMs).

- [Overview](overview.md)
- [Installation](installation.md)
- [Usage](usage.md)
- [API Reference](reference/brickllm.md)
19 changes: 19 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Installation

BrickLLM can be installed using [pip](https://pypi.org/project/brickllm/).

```bash
pip install brickllm
```

Alternatively, using [Poetry](https://python-poetry.org/), which handles dependency management.

```bash
# Clone the repository
git clone https://github.com/EURAC-EEBgroup/brickllm-lib.git
cd brickllm-lib

# Install dependencies
poetry install
```

37 changes: 37 additions & 0 deletions docs/modules/brickllm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# BrickLLM Module

The `brickllm` package is the main package containing all modules and components related to generating BrickSchema-compliant RDF files using LLMs.

## Contents

### Edges
- [validate_condition.py](../reference/edges/validate_condition.md)

### Graphs
- [brickschema_graph.py](../reference/graphs/brickschema_graph.md)

### Helpers
- [llm_models.py](../reference/helpers/llm_models.md)
- [prompts.py](../reference/helpers/prompts.md)

### Nodes
- [get_elem_children.py](../reference/nodes/get_elem_children.md)
- [get_elements.py](../reference/nodes/get_elements.md)
- [get_relationships.py](../reference/nodes/get_relationships.md)
- [get_sensors.py](../reference/nodes/get_sensors.md)
- [schema_to_ttl.py](../reference/nodes/schema_to_ttl.md)
- [validate_schema.py](../reference/nodes/validate_schema.md)

### Ontologies
- [brick_hierarchy.json](../reference/ontologies/brick_hierarchy.md)
- [Brick.ttl](../reference/ontologies/Brick.md)

### Utils
- [get_hierarchy_info.py](../reference/utils/get_hierarchy_info.md)
- [query_brickschema.py](../reference/utils/query_brickschema.md)

### Root-Level Files
- [compiled_graphs.py](../reference/compiled_graphs.md)
- [configs.py](../reference/configs.md)
- [schemas.py](../reference/schemas.md)
- [states.py](../reference/states.md)
8 changes: 8 additions & 0 deletions docs/modules/edges.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# Edges Module

The `edges` module contains components related to the validation of relationships (edges) between entities in the graph.

## Contents

- [validate_condition.py](../reference/edges/validate_condition.md)
8 changes: 8 additions & 0 deletions docs/modules/graphs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# Graphs Module

The `graphs` module contains components that manage and execute the BrickSchema graph operations.

## Contents

- [brickschema_graph.py](../reference/graphs/brickschema_graph.md)
9 changes: 9 additions & 0 deletions docs/modules/helpers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Helpers Module

The `helpers` module contains utility functions and prompts that assist in LLM interactions and data processing.

## Contents

- [llm_models.py](../reference/helpers/llm_models.md)
- [prompts.py](../reference/helpers/prompts.md)
13 changes: 13 additions & 0 deletions docs/modules/nodes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Nodes Module

The `nodes` module contains specialized components that perform tasks such as element identification, hierarchy construction, and RDF conversion.

## Contents

- [get_elem_children.py](../reference/nodes/get_elem_children.md)
- [get_elements.py](../reference/nodes/get_elements.md)
- [get_relationships.py](../reference/nodes/get_relationships.md)
- [get_sensors.py](../reference/nodes/get_sensors.md)
- [schema_to_ttl.py](../reference/nodes/schema_to_ttl.md)
- [validate_schema.py](../reference/nodes/validate_schema.md)
9 changes: 9 additions & 0 deletions docs/modules/ontologies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Ontologies Module

The `ontologies` module contains the BrickSchema and hierarchy files used for representing and managing the building systems.

## Contents

- [brick_hierarchy.json](../reference/ontologies/brick_hierarchy.md)
- [Brick.ttl](../reference/ontologies/Brick.md)
9 changes: 9 additions & 0 deletions docs/modules/utils.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# Utils Module

The `utils` module contains components related to querying and retrieving data from the BrickSchema.

## Contents

- [get_hierarchy_info.py](../reference/utils/get_hierarchy_info.md)
- [query_brickschema.py](../reference/utils/query_brickschema.md)
25 changes: 25 additions & 0 deletions docs/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Overview

BrickLLM is a Python library designed to generate RDF (Resource Description Framework) files that comply with the BrickSchema ontology using Large Language Models (LLMs). The library leverages advanced natural language processing capabilities to interpret building descriptions and convert them into structured, machine-readable formats suitable for building automation and energy management systems.

## Main Features

- **Multi-provider LLM Support**: Supports multiple LLM providers, including OpenAI, Anthropic, and Fireworks AI.
- **Natural Language to RDF Conversion**: Converts natural language descriptions of buildings and facilities into BrickSchema-compliant RDF.
- **Customizable Graph Execution**: Utilizes LangGraph for flexible and customizable graph-based execution of the conversion process.
- **Ontology Integration**: Incorporates the BrickSchema ontology for accurate and standardized representation of building systems.
- **Extensible Architecture**: Designed with modularity in mind, allowing for easy extension and customization.

## How It Works

1. **User Input**: The process begins with a natural language description of a building or facility provided by the user.

2. **LLM Processing**: The description is processed by a selected LLM to extract relevant building components and their relationships.

3. **Graph Execution**: The extracted information is passed through a series of nodes in a graph structure:
- **Element Identification**: Identifies building elements from the user prompt.
- **Hierarchy Construction**: Builds a hierarchical structure of the identified elements.
- **Relationship Mapping**: Determines relationships between the components.
- **TTL Generation**: Converts the structured data into Turtle (TTL) format, which is a serialization of RDF.

4. **Output Generation**: The final output is a BrickSchema-compliant RDF file in TTL format, representing the building's structure and systems.
32 changes: 32 additions & 0 deletions docs/reference/brickllm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# BrickLLM API Reference

Welcome to the API Reference for the `BrickLLM` library. This section of the documentation provides detailed information about the modules, classes, functions, and other components that make up the BrickLLM library.

## Overview

`BrickLLM` is a Python library designed to generate BrickSchema-compliant RDF files using Large Language Models (LLMs). It provides various utilities for parsing natural language building descriptions, extracting relevant components, and constructing a structured graph that represents the building and its systems.

This API reference covers all the essential modules and functions available in the library, including components for:

- **Element identification**
- **Relationship mapping**
- **TTL generation** (Turtle format RDF)
- **Ontology integration** (BrickSchema)

## Key Modules

- **Edges**: Validation of relationships (edges) between entities in the graph.
- **Graphs**: Handles the orchestration of graph-based operations with the BrickSchema.
- **Helpers**: Contains utility functions and predefined LLM prompts to aid in the generation process.
- **Nodes**: Specialized nodes that handle various tasks such as extracting elements, constructing hierarchies, and generating RDF files.
- **Ontologies**: Includes the BrickSchema ontology and hierarchical data.
- **Utils**: Utility functions for querying the BrickSchema and handling RDF data.

## How to Use the API Reference

- Navigate to individual modules and components via the side navigation or by clicking on the links in the module overview sections.
- Each module contains a breakdown of its functions, classes, and attributes, with descriptions and examples where applicable.

For an in-depth guide on how to use the library in practice, see the [Usage](../usage.md) section.

Happy coding!
4 changes: 4 additions & 0 deletions docs/reference/compiled_graphs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# compiled_graphs.py

::: brickllm.compiled_graphs
4 changes: 4 additions & 0 deletions docs/reference/configs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# configs.py

::: brickllm.configs
4 changes: 4 additions & 0 deletions docs/reference/edges/validate_condition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# validate_condition.py

::: brickllm.edges.validate_condition
4 changes: 4 additions & 0 deletions docs/reference/graphs/brickschema_graph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# brickschema_graph.py

::: brickllm.graphs.brickschema_graph
4 changes: 4 additions & 0 deletions docs/reference/helpers/llm_models.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# llm_models.py

::: brickllm.helpers.llm_models
4 changes: 4 additions & 0 deletions docs/reference/helpers/prompts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# prompts.py

::: brickllm.helpers.prompts
4 changes: 4 additions & 0 deletions docs/reference/nodes/get_elem_children.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# get_elem_children.py

::: brickllm.nodes.get_elem_children
4 changes: 4 additions & 0 deletions docs/reference/nodes/get_elements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# get_elements.py

::: brickllm.nodes.get_elements
4 changes: 4 additions & 0 deletions docs/reference/nodes/get_relationships.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# get_relationships.py

::: brickllm.nodes.get_relationships
4 changes: 4 additions & 0 deletions docs/reference/nodes/get_sensors.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# get_sensors.py

::: brickllm.nodes.get_sensors
4 changes: 4 additions & 0 deletions docs/reference/nodes/schema_to_ttl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# schema_to_ttl.py

::: brickllm.nodes.schema_to_ttl
4 changes: 4 additions & 0 deletions docs/reference/nodes/validate_schema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# validate_schema.py

::: brickllm.nodes.validate_schema
4 changes: 4 additions & 0 deletions docs/reference/ontologies/Brick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# Brick.ttl

This file contains the BrickSchema ontology in Turtle (TTL) format.
4 changes: 4 additions & 0 deletions docs/reference/ontologies/brick_hierarchy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# brick_hierarchy.json

This file contains the hierarchical structure of the BrickSchema entities in JSON format.
4 changes: 4 additions & 0 deletions docs/reference/schemas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# schemas.py

::: brickllm.schemas
4 changes: 4 additions & 0 deletions docs/reference/states.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# states.py

::: brickllm.states
4 changes: 4 additions & 0 deletions docs/reference/utils/get_hierarchy_info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# get_hierarchy_info.py

::: brickllm.utils.get_hierarchy_info
4 changes: 4 additions & 0 deletions docs/reference/utils/query_brickschema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# query_brickschema.py

::: brickllm.utils.query_brickschema
1 change: 1 addition & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Usage
Loading

0 comments on commit d38421e

Please sign in to comment.