Remove initial db directory.
This commit is contained in:
parent
4ee777118d
commit
1dd9adbba2
@ -1,62 +0,0 @@
|
||||
question: |-
|
||||
I want to start a Python project on github with the name ChatMastermind. Give me the full package structure with all the files required.
|
||||
answer: |-
|
||||
To create a Python project on GitHub with the name "ChatMastermind", follow these steps:
|
||||
|
||||
1. Create a new repository on GitHub named "ChatMastermind".
|
||||
|
||||
2. Clone the repository to your local machine.
|
||||
|
||||
3. Now, let's create the package structure for the project. Here's a suggested package structure:
|
||||
|
||||
```
|
||||
ChatMastermind/
|
||||
|-- .gitignore
|
||||
|-- README.md
|
||||
|-- LICENSE
|
||||
|-- setup.py
|
||||
|-- chatmastermind/
|
||||
|-- __init__.py
|
||||
|-- main.py
|
||||
|-- api_client.py
|
||||
|-- storage.py
|
||||
|-- utils.py
|
||||
|-- tests/
|
||||
|-- __init__.py
|
||||
|-- test_main.py
|
||||
|-- test_api_client.py
|
||||
|-- test_storage.py
|
||||
|-- test_utils.py
|
||||
|-- examples/
|
||||
|-- example.py
|
||||
|-- requirements.txt
|
||||
```
|
||||
|
||||
- `.gitignore`: Contains a list of files and directories that should be ignored by git.
|
||||
- `README.md`: Documentation for your project.
|
||||
- `LICENSE`: The license for your project.
|
||||
- `setup.py`: Python package setup script.
|
||||
- `chatmastermind`: The main package directory.
|
||||
- `__init__.py`: Initialize the package.
|
||||
- `main.py`: The main script to run the application.
|
||||
- `api_client.py`: Handles conversation with the AI.
|
||||
- `storage.py`: Manages storing question+answer pairs with tags.
|
||||
- `utils.py`: Contains utility/helper functions.
|
||||
- `tests`: Directory containing tests.
|
||||
- `test_main.py`: Tests for the main script.
|
||||
- `test_api_client.py`: Tests for the API client.
|
||||
- `test_storage.py`: Tests for storage functions.
|
||||
- `test_utils.py`: Tests for utility functions.
|
||||
- `examples`: Directory containing example scripts.
|
||||
- `example.py`: An example of how to use the package.
|
||||
- `requirements.txt`: Lists the required packages for your project.
|
||||
|
||||
4. Create these files and directories in your local repository.
|
||||
|
||||
5. Add and commit the changes to the repository.
|
||||
|
||||
6. Push the changes to the remote repository on GitHub.
|
||||
|
||||
Now you have your Python project called "ChatMastermind" on GitHub with the package structure ready for development.
|
||||
tags:
|
||||
- PackageStructure
|
||||
@ -1,47 +0,0 @@
|
||||
question: |-
|
||||
Give me the content of the setup.py file.
|
||||
answer: |-
|
||||
To create a `setup.py` file for the ChatMastermind project, use the following content:
|
||||
|
||||
```python
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
with open("README.md", "r", encoding="utf-8") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setup(
|
||||
name="ChatMastermind",
|
||||
version="0.1.0",
|
||||
author="Your Name",
|
||||
author_email="your.email@example.com",
|
||||
description="A Python application to automate conversation with AI, store question+answer pairs, and compose chat history.",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/yourusername/ChatMastermind",
|
||||
packages=find_packages(),
|
||||
classifiers=[
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
],
|
||||
install_requires=[
|
||||
# Add your project's dependencies here
|
||||
],
|
||||
python_requires=">=3.6",
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"chatmastermind=chatmastermind.main:main",
|
||||
],
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
Replace "Your Name", "your.email@example.com", and "yourusername" with your own information. Make sure to also update the `install_requires` list with any dependencies your project needs. This `setup.py` file uses the setuptools package to define the project's metadata, dependencies, and entry points for console scripts.
|
||||
tags:
|
||||
- FileSetupPy
|
||||
@ -1,58 +0,0 @@
|
||||
question: |-
|
||||
Give me the content of requirements.txt file and change the setup.py file to contain following requirements: openai, PyYAML, argcomplete.
|
||||
answer: |-
|
||||
For the `requirements.txt` file, add the following content:
|
||||
|
||||
```
|
||||
openai
|
||||
PyYAML
|
||||
argcomplete
|
||||
```
|
||||
|
||||
Now, update the `setup.py` file to include these requirements:
|
||||
|
||||
```python
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
with open("README.md", "r", encoding="utf-8") as fh:
|
||||
long_description = fh.read()
|
||||
|
||||
setup(
|
||||
name="ChatMastermind",
|
||||
version="0.1.0",
|
||||
author="Your Name",
|
||||
author_email="your.email@example.com",
|
||||
description="A Python application to automate conversation with AI, store question+answer pairs, and compose chat history.",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/yourusername/ChatMastermind",
|
||||
packages=find_packages(),
|
||||
classifiers=[
|
||||
"Development Status :: 3 - Alpha",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
],
|
||||
install_requires=[
|
||||
"openai",
|
||||
"PyYAML",
|
||||
"argcomplete",
|
||||
],
|
||||
python_requires=">=3.6",
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"chatmastermind=chatmastermind.main:main",
|
||||
],
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
This will include the "openai", "PyYAML", and "argcomplete" packages as dependencies for your project.
|
||||
tags:
|
||||
- FileRequirementsTxt
|
||||
- Requirements
|
||||
@ -1,115 +0,0 @@
|
||||
question: |-
|
||||
Give me the README.md file content.
|
||||
answer: |-
|
||||
Here's the content of the `README.md` file, describing the ChatMastermind project and the provided script:
|
||||
|
||||
```
|
||||
# ChatMastermind
|
||||
|
||||
ChatMastermind is a Python application that automates conversation with AI, stores question-answer pairs with tags, and composes a relevant chat history for the next question.
|
||||
|
||||
The project uses the OpenAI API to generate responses, and stores the data in YAML files. It also allows you to filter the chat history based on tags, and supports autocompletion for tags.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.6 or higher
|
||||
- openai
|
||||
- PyYAML
|
||||
- argcomplete
|
||||
|
||||
You can install these requirements using `pip`:
|
||||
|
||||
```
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
cmm [-h] [-p PRINT | -q QUESTION | -D | -d] [-c CONFIG] [-m MAX_TOKENS] [-T TEMPERATURE] [-M MODEL] [-n NUMBER] [-t [TAGS [TAGS ...]]] [-e [EXTAGS [EXTAGS ...]]] [-o [OTAGS [OTAGS ...]]]
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
- `-p`, `--print`: YAML file to print.
|
||||
- `-q`, `--question`: Question to ask.
|
||||
- `-D`, `--chat-dump`: Print chat as a Python structure.
|
||||
- `-d`, `--chat`: Print chat as readable text.
|
||||
- `-c`, `--config`: Config file name (defaults to `.config.yaml`).
|
||||
- `-m`, `--max-tokens`: Max tokens to use.
|
||||
- `-T`, `--temperature`: Temperature to use.
|
||||
- `-M`, `--model`: Model to use.
|
||||
- `-n`, `--number`: Number of answers to produce (default is 3).
|
||||
- `-t`, `--tags`: List of tag names.
|
||||
- `-e`, `--extags`: List of tag names to exclude.
|
||||
- `-o`, `--output-tags`: List of output tag names (default is the input tags).
|
||||
|
||||
### Examples
|
||||
|
||||
1. Print the contents of a YAML file:
|
||||
|
||||
```
|
||||
cmm -p example.yaml
|
||||
```
|
||||
|
||||
2. Ask a question:
|
||||
|
||||
```
|
||||
cmm -q "What is the meaning of life?" -t philosophy -e religion
|
||||
```
|
||||
|
||||
3. Display the chat history as a Python structure:
|
||||
|
||||
```
|
||||
cmm -D
|
||||
```
|
||||
|
||||
4. Display the chat history as readable text:
|
||||
|
||||
```
|
||||
cmm -d
|
||||
```
|
||||
|
||||
5. Filter chat history by tags:
|
||||
|
||||
```
|
||||
cmm -d -t tag1 tag2
|
||||
```
|
||||
|
||||
6. Exclude chat history by tags:
|
||||
|
||||
```
|
||||
cmm -d -e tag3 tag4
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The configuration file (`.config.yaml`) should contain the following fields:
|
||||
|
||||
- `openai`:
|
||||
- `api_key`: Your OpenAI API key.
|
||||
- `model`: The name of the OpenAI model to use (e.g. "text-davinci-002").
|
||||
- `temperature`: The temperature value for the model.
|
||||
- `max_tokens`: The maximum number of tokens for the model.
|
||||
- `top_p`: The top P value for the model.
|
||||
- `frequency_penalty`: The frequency penalty value.
|
||||
- `presence_penalty`: The presence penalty value.
|
||||
- `system`: The system message used to set the behavior of the AI.
|
||||
- `db`: The directory where the question-answer pairs are stored in YAML files.
|
||||
|
||||
## Autocompletion
|
||||
|
||||
To activate autocompletion for tags, add the following line to your shell's configuration file (e.g., `.bashrc`, `.zshrc`, or `.profile`):
|
||||
|
||||
```
|
||||
eval "$(register-python-argcomplete chatmastermind)"
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the terms of the WTFPL License.
|
||||
```
|
||||
|
||||
You can modify the `README.md` file as needed to provide more information or examples.
|
||||
tags:
|
||||
- FileReadmeMd
|
||||
Loading…
x
Reference in New Issue
Block a user