Skip to content

Commit

Permalink
docs: imporeved docs and ttl_output method
Browse files Browse the repository at this point in the history
  • Loading branch information
PeriniM committed Nov 11, 2024
1 parent f507cf5 commit 24a7d8b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

BrickLLM is a Python library for generating RDF files following the BrickSchema ontology using Large Language Models (LLMs).

## Features
## 🚀 Features

- Generate BrickSchema-compliant RDF files from natural language descriptions of buildings and facilities
- Support for multiple LLM providers (OpenAI, Anthropic, Fireworks)
Expand Down Expand Up @@ -224,12 +224,12 @@ brick_graph_local.save_ttl_output("my_building_local.ttl")
## 📖 Documentation
For more detailed information on how to use BrickLLM, please refer to our [documentation](https://brickllm.com/docs).
For more detailed information on how to use BrickLLM, please refer to our [documentation](https://eurac-eebgroup.github.io/brick-llm/).
## ▶️ Web Application
A web app is available to use the library directly through an interface at the following link ().
The application can also be used locally as described in the dedicated repository [BrickLLM App](https://github.com/EURAC-EEBgroup/Brick_ontology_tool).
A web app is available to use the library directly through an interface at the following link ().
The application can also be used locally as described in the dedicated repository [BrickLLM App](https://github.com/EURAC-EEBgroup/Brick_ontology_tool).
**Note**: The tool is currently being deployed on our servers and on the MODERATE platform. It will be online shortly !
Expand All @@ -241,25 +241,25 @@ We welcome contributions to BrickLLM! Please see our [contributing guidelines](C
BrickLLM is released under the BSD-3-Clause License. See the [LICENSE](LICENSE) file for details.
## Contact
## 📧 Contact
For any questions or support, please contact:
- Marco Perini <[email protected]>
- Daniele Antonucci <[email protected]>
- Rocco Giudice <[email protected]>
## Citation
## 📝 Citation
Please cite us if you use the library
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14039358.svg)](https://zenodo.org/doi/10.5281/zenodo.14039358)
## 💙 Aknwoledegments
This work was carried out within European projects:
## 💙 Acknowledgements
This work was carried out within European projects:
<p align="center">
<img src="https://raw.githubusercontent.com/EURAC-EEBgroup/brick-llm/refs/heads/main/docs/assets/moderate_logo.png" alt="Moderate"
<img src="https://raw.githubusercontent.com/EURAC-EEBgroup/brick-llm/refs/heads/main/docs/assets/moderate_logo.png" alt="Moderate"
</p>
Moderate - Horizon Europe research and innovation programme under grant agreement No 101069834, with the aim of contributing to the development of open products useful for defining plausible scenarios for the decarbonization of the built environment
Expand Down
13 changes: 5 additions & 8 deletions brickllm/graphs/abstract_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def __init__(self, model: Union[str, BaseChatModel] = "openai"):
self.graph = None
self.config = {"configurable": {"thread_id": "1", "llm_model": self.model}}
self.result = None
self.ttl_output = None

@abstractmethod
def build_graph(self):
Expand Down Expand Up @@ -75,12 +76,8 @@ def save_ttl_output(self, output_file: str = "brick_schema_output.ttl") -> None:
if self.result is None:
raise ValueError("No result found. Please run the graph first.")

ttl_output = self.result.get("ttl_output", None)
if self.ttl_output is None:
raise ValueError("No TTL output found. Please run the graph first.")

if ttl_output:
with open(output_file, "w") as f:
f.write(ttl_output)
else:
raise ValueError(
"No TTL output found in the result. Please run the graph with a valid prompt."
)
with open(output_file, "w") as f:
f.write(self.ttl_output)
2 changes: 2 additions & 0 deletions brickllm/graphs/brickschema_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def run(
):
events.append(event)
self.result = events[-1]
self.ttl_output = self.result.get("ttl_output", None)
return events
else:
self.result = self.graph.invoke(input_data, self.config)
self.ttl_output = self.result.get("ttl_output", None)
return self.result
2 changes: 2 additions & 0 deletions brickllm/graphs/brickschema_graph_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ def run(
):
events.append(event)
self.result = events[-1]
self.ttl_output = self.result.get("ttl_output", None)
return events
else:
self.result = self.graph.invoke(input_data, self.config)
self.ttl_output = self.result.get("ttl_output", None)
return self.result

0 comments on commit 24a7d8b

Please sign in to comment.