This repository is created as part of an O'Reilly project to explore the fundamentals of AI agents. It features two main components:
- Document Question-Answering (
src/01_document_qa.py): Utilizes a conversational model to answer questions based on a given text dataset. - Chatbot (
src/02_chatbot.py): A simple chatbot implemented using Hugging Face'shugchatlibrary.
- Python 3.6+
- poetry for dependency management
Clone the repository:
git clone https://github.com/yourusername/what_is_an_ai_agent_oreilly.gitNavigate to the project directory:
cd what_is_an_ai_agent_oreilly/Install the dependencies:
poetry install-
Environment Setup: Create a
.envfile in the project root and set your OpenAI API key:OPENAI_API_KEY=your_api_key_here
-
Data Preparation: Place your
.csvdata files in thedata/sample_book_dataset/directory. -
Run the Script: Execute the following command:
python src/01_document_qa.py
-
Follow the Instructions: Upload your text file when prompted and interact with the agent.
-
Environment Setup: Add your Hugging Face credentials to Streamlit's secrets:
st.secrets["HUGGINGFACE_EMAIL"] = your_email_here st.secrets["HUGGINGFACE_PASSWORD"] = your_password_here
-
Run the Script: Execute the following command:
streamlit run src/02_chatbot.py
-
Interact: Open the Streamlit app and start chatting with the bot.
.
├── data/
│ ├── sample_book_dataset/
├── Makefile
├── poetry.lock
├── pyproject.toml
├── README.md
└── src/
├── 01_document_qa.py
└── 02_chatbot.py
If you wish to contribute to this project, please read the CONTRIBUTING.md guide.
This project is licensed under the MIT License. See the LICENSE.md file for details.
- O'Reilly for the opportunity to explore AI agents.
- OpenAI for their conversational models.
- Hugging Face for their
hugchatlibrary.