Here's a README.md
file for your project:
The LLM Wiki Generator is a dynamic web server built with Python's standard library and an AI-powered language model (LLM) from Ollama. This project allows you to generate Wikipedia-like web pages on-the-fly, where each URL path corresponds to a unique article title. The content is generated by the llama3:8b
model, making each visit to the server an opportunity to explore fresh, AI-created content.
- Dynamic Content Generation: Generates HTML content dynamically based on the request path.
- AI-Powered: Utilizes the
llama3:8b
language model from Ollama for content creation. - Real-time Debugging: Includes a debug mode to stream AI responses directly to the console.
- Simple and Portable: Built using Python's
http.server
for easy setup and portability.
- Python 3.x
- Ollama installed on your system
- Python package for Ollama
-
Clone the Repository
git clone https://github.com/your-username/llm-wiki-generator.git cd llm-wiki-generator
-
Install Ollama and the Required Model
Follow the instructions on Ollama's website to install Ollama and the
llama3:8b
model. -
Install the Ollama Python Package
pip install ollama
-
Run the Server
Start the server by executing the following command:
python server.py
-
Access the Web Pages
Open your browser and navigate to
http://localhost:9000/
. Try different URLs like/Python
,/AI
,/help
, or/login
to see dynamically generated content. -
Debug Mode
If you want to see the AI response streamed in real-time, set the
DEBUG
flag toTrue
in theserver.py
file.
server.py
: The main script that sets up the HTTP server and interacts with the LLM to generate content.extract_html_block_from_chat_response(response)
: A utility function to extract the HTML content from the LLM's response.generate_webpage_from_request_path(request_path)
: The core function that sends prompts to the LLM and retrieves the generated HTML content.
Contributions are welcome! Please comment below and suggest changes.
- Ollama for providing the language model.
- Python's
http.server
for the simple yet effective HTTP server capabilities.