Metadata-Version: 2.1
Name: llmgraph
Version: 0.9.0
Summary: Create knowledge graphs with LLMs
Home-page: https://github.com/dylanhogg/llmgraph
License: MIT
Keywords: Knowledge graph,LLM
Author: Dylan Hogg
Author-email: dylanhogg@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Dist: beautifulsoup4 (>=4.12.2,<5.0.0)
Requires-Dist: click (>=8.1.7,<9.0.0)
Requires-Dist: httpx (>=0.25.0,<0.26.0)
Requires-Dist: joblib (>=1.3.2,<2.0.0)
Requires-Dist: loguru (>=0.7.2,<0.8.0)
Requires-Dist: matplotlib (>=3.8.0,<4.0.0)
Requires-Dist: networkx (>=3.1,<4.0)
Requires-Dist: omegaconf (>=2.3.0,<3.0.0)
Requires-Dist: openai (>=0.28.1,<0.29.0)
Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
Requires-Dist: pyvis (>=0.3.2,<0.4.0)
Requires-Dist: rich (>=13.6.0,<14.0.0)
Requires-Dist: tenacity (>=8.2.3,<9.0.0)
Requires-Dist: tqdm (>=4.66.1,<5.0.0)
Requires-Dist: typer (>=0.9.0,<0.10.0)
Project-URL: Repository, https://github.com/dylanhogg/llmgraph
Description-Content-Type: text/markdown

# llmgraph

llmgraph enables you to create knowledge graphs in GraphML, GEXF, and HTML formats from a given source entity Wikipedia page. The knowledge graphs are generated by extracting world knowledge from ChatGPT or other large language models (LLMs).

## Features

- Create knowledge graphs from a source entity Wikipedia page.
- Support for generating knowledge graphs in HTML, GraphML, and GEXF formats.
- Utilizes the power of ChatGPT and other large language models to extract world knowledge.

## Installation

You can install llmgraph using pip:

```bash
pip install llmgraph
```

## Example Output

In addition to GraphML and GEXF formats, an HTML [pyvis](https://github.com/WestHealth/pyvis) physics enabled graph can be viewed:

![example machine learning output](https://github.com/dylanhogg/llmgraph/blob/main/docs/img/machine-learning_artificial-intelligence_v0.3.0_level3.png?raw=true)

## Example Usage

The example above was generated with the following command:

```bash
llmgraph machine-learning "https://en.wikipedia.org/wiki/Artificial_intelligence" --levels 3
```

It used a total of 7,650 gpt-3.5-turbo tokens to render 3 layers from the root 'Artificial Intelligence' node.

### Required Arguments

- `entity_type` (TEXT): Entity type (e.g. movie)
- `entity_wikipedia` (TEXT): Full Wikipedia link to the root entity

### Optional Arguments

- `--entity-root` (TEXT): Optional root entity name override if different from the Wikipedia page title [default: None]
- `--levels` (INTEGER): Number of levels deep to construct from the central root entity [default: 2]
- `--max-sum-total-tokens` (INTEGER): Maximum sum of tokens for graph generation [default: 200000]
- `--output-folder` (TEXT): Folder location to write outputs [default: ./_output/]
- `--llm-model` (TEXT): The model name [default: gpt-3.5-turbo]
- `--llm-temp` (FLOAT): LLM temperature value [default: 0.0]
- `--llm-use-localhost` (INTEGER): LLM use localhost:8081 instead of OpenAI [default: 0]
- `--help`: Show this message and exit.

## Contributing

We welcome contributions to llmgraph. To contribute, please follow these steps:

1. Fork the repository.
2. Create a new branch for your feature or bug fix.
3. Make your changes and commit them.
4. Create a pull request with a clear description of your changes.

