├── .gitignore ├── .streamlit └── config.toml ├── CONTRIBUTING.md ├── README.md ├── __pycache__ ├── prompts.cpython-310.pyc ├── render.cpython-310.pyc └── utils.cpython-310.pyc ├── app.py ├── prompts.py ├── render.py ├── requirements.txt └── utils.py /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | /.streamlit/secrets.toml 3 | -------------------------------------------------------------------------------- /.streamlit/config.toml: -------------------------------------------------------------------------------- 1 | [theme] 2 | primaryColor="#F63366" 3 | backgroundColor="#FFFFFF" 4 | secondaryBackgroundColor="#F0F2F6" 5 | textColor="#262730" 6 | font="sans serif" -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to HormoziGPT 2 | 3 | First of all, thank you for considering contributing to HormoziGPT! I made this project as an experiment in creating artificial personalities based on existing content, so I appreciate any help and contributions from the community. Whether you're submitting a bug report, suggesting a new feature, or contributing code, your contributions are valuable and help improve the project. 4 | 5 | ## How to Contribute 6 | 7 | ### Reporting Bugs 8 | 9 | If you encounter any bugs or issues while using HormoziGPT, please open an issue on the GitHub repository. When submitting a bug report, please include the following information: 10 | 11 | - A clear and descriptive title for the issue. 12 | - A detailed description of the issue, including steps to reproduce it. 13 | - Information about your environment, such as the operating system and Python version you're using. 14 | 15 | ### Suggesting Enhancements 16 | 17 | If you have an idea for a new feature or enhancement, please open an issue on the GitHub repository. When suggesting an enhancement, please include the following information: 18 | 19 | - A clear and descriptive title for the issue. 20 | - A detailed description of the proposed enhancement, including any benefits and potential use cases. 21 | - Any relevant examples or mockups, if applicable. 22 | 23 | ### Contributing Code 24 | 25 | If you'd like to contribute code to HormoziGPT, please follow these steps: 26 | 27 | 1. Fork the HormoziGPT repository on GitHub. 28 | 2. Clone your fork to your local machine. 29 | 3. Create a new branch for your changes (e.g., `git checkout -b my-feature-branch`). 30 | 4. Make your changes and commit them to your branch. 31 | 5. Push your changes to your fork on GitHub. 32 | 6. Open a pull request against the `main` branch of the HormoziGPT repository. 33 | 34 | When submitting a pull request, please include a clear and descriptive title and a detailed description of your changes. If your pull request addresses an existing issue, please reference the issue number in the description. 35 | 36 | ## Code of Conduct 37 | 38 | I strive to create a welcoming and inclusive environment for all contributors. Please be respectful and considerate in your interactions with others. 39 | 40 | ## Contact 41 | 42 | If you have any questions or need assistance, please feel free to reach out to me directly. You can contact me via [GitHub](https://github.com/wombyz) or [email](mailto:admin@liamottley.com). 43 | 44 | Thank you again for your interest in contributing to HormoziGPT, and I look forward to collaborating with you! 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HormoziGPT 2 | 3 | HormoziGPT is a chatbot application that simulates a conversation with Alex Hormozi. The chatbot provides valuable business advice and coaching to users, drawing from Alex's experience in customer acquisition, monetization, and scaling businesses. It also has access to transcripts of Alex's podcasts, which are used to provide context and support for the chatbot's responses. 4 | 5 | ## Features 6 | 7 | - Engage in a conversation with a chatbot that emulates Alex Hormozi's communication style. 8 | - Receive focused, practical, and direct business advice. 9 | - Access relevant snippets from transcripts of Alex's podcasts to support the chatbot's responses. 10 | - Utilize semantic search to find relevant content from the transcripts. 11 | 12 | ## Getting Started 13 | 14 | ### Prerequisites 15 | 16 | - Python 3.7 or higher 17 | - OpenAI API key 18 | - Pinecone API key and environment details 19 | 20 | ### Installation 21 | 22 | 1. Clone the repository: 23 | ``` 24 | git clone https://github.com/your-repo-url/HormoziGPT.git 25 | ``` 26 | 2. Change to the project directory: 27 | ``` 28 | cd HormoziGPT 29 | ``` 30 | 3. Install the required dependencies: 31 | ``` 32 | pip install -r requirements.txt 33 | ``` 34 | 4. Set up the environment variables: 35 | - `OPENAI_API_KEY`: Your OpenAI API key 36 | - `PINECONE_API_KEY`: Your Pinecone API key 37 | - `PINECONE_ENVIRONMENT`: Your Pinecone environment details 38 | - `PINECONE_ENDPOINT`: Your Pinecone endpoint 39 | 40 | ### Usage 41 | 42 | 1. Run the Streamlit app: 43 | ``` 44 | streamlit run app.py 45 | ``` 46 | 2. Open the app in your web browser and enter your prompt to start the conversation with the chatbot. 47 | 48 | ## Contributing 49 | 50 | Contributions are welcome! Please read the [CONTRIBUTING.md](CONTRIBUTING.md) file for details on how to contribute to the project. 51 | 52 | ## Acknowledgments 53 | 54 | - Alex Hormozi for his valuable insights and business advice! (don't sue me) 55 | - OpenAI for their language models and embeddings. 56 | - Pinecone for their semantic search capabilities. 57 | -------------------------------------------------------------------------------- /__pycache__/prompts.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wombyz/HormoziGPT/781f775d82017d734e00b2b89bc5ae4f942c4189/__pycache__/prompts.cpython-310.pyc -------------------------------------------------------------------------------- /__pycache__/render.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wombyz/HormoziGPT/781f775d82017d734e00b2b89bc5ae4f942c4189/__pycache__/render.cpython-310.pyc -------------------------------------------------------------------------------- /__pycache__/utils.cpython-310.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wombyz/HormoziGPT/781f775d82017d734e00b2b89bc5ae4f942c4189/__pycache__/utils.cpython-310.pyc -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | import os 2 | import openai 3 | import streamlit as st 4 | from dotenv import load_dotenv 5 | from render import bot_msg_container_html_template, user_msg_container_html_template 6 | from utils import semantic_search 7 | import prompts 8 | import pinecone 9 | 10 | 11 | # Set up OpenAI API key 12 | openai.api_key = st.secrets["OPENAI_API_KEY"] 13 | pinecone.init(api_key=st.secrets["PINECONE_API_KEY"], environment=st.secrets["PINECONE_ENVIRONMENT"]) 14 | index = pinecone.Index(st.secrets["PINECONE_INDEX_NAME"]) 15 | 16 | st.header("HormoziGPT - By Liam Ottley") 17 | 18 | # Define chat history storage 19 | if "history" not in st.session_state: 20 | st.session_state.history = [] 21 | 22 | # Construct messages from chat history 23 | def construct_messages(history): 24 | messages = [{"role": "system", "content": prompts.system_message}] 25 | 26 | for entry in history: 27 | role = "user" if entry["is_user"] else "assistant" 28 | messages.append({"role": role, "content": entry["message"]}) 29 | 30 | return messages 31 | 32 | # Generate response to user prompt 33 | def generate_response(): 34 | st.session_state.history.append({ 35 | "message": st.session_state.prompt, 36 | "is_user": True 37 | }) 38 | 39 | print(f"Query: {st.session_state.prompt}") 40 | 41 | # Perform semantic search and format results 42 | search_results = semantic_search(st.session_state.prompt, index, top_k=3) 43 | 44 | print(f"Results: {search_results}") 45 | 46 | context = "" 47 | for i, (title, transcript) in enumerate(search_results): 48 | context += f"Snippet from: {title}\n {transcript}\n\n" 49 | 50 | # Generate human prompt template and convert to API message format 51 | query_with_context = prompts.human_template.format(query=st.session_state.prompt, context=context) 52 | 53 | # Convert chat history to a list of messages 54 | messages = construct_messages(st.session_state.history) 55 | messages.append({"role": "user", "content": query_with_context}) 56 | 57 | # Run the LLMChain 58 | response = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=messages) 59 | print(messages) 60 | 61 | # Parse response 62 | bot_response = response["choices"][0]["message"]["content"] 63 | st.session_state.history.append({ 64 | "message": bot_response, 65 | "is_user": False 66 | }) 67 | 68 | # User input prompt 69 | user_prompt = st.text_input("Enter your prompt:", 70 | key="prompt", 71 | placeholder="e.g. 'Write me a business plan to scale my coaching business'", 72 | on_change=generate_response 73 | ) 74 | 75 | # Display chat history 76 | for message in st.session_state.history: 77 | if message["is_user"]: 78 | st.write(user_msg_container_html_template.replace("$MSG", message["message"]), unsafe_allow_html=True) 79 | else: 80 | st.write(bot_msg_container_html_template.replace("$MSG", message["message"]), unsafe_allow_html=True) 81 | -------------------------------------------------------------------------------- /prompts.py: -------------------------------------------------------------------------------- 1 | system_message = """ 2 | You are Alex Hormozi, a successful entrepreneur and investor known for your no-nonsense approach to business advice. You have founded and scaled multiple companies, and you have a wealth of experience in customer acquisition, monetization, and scaling businesses. 3 | 4 | Your goal is to provide valuable business advice and coaching to users. Your responses should be focused, practical, and direct, mirroring your own communication style. Avoid sugarcoating or beating around the bush—users expect you to be straightforward and honest. 5 | 6 | You have access to transcripts of your own podcasts stored in a Pinecone database. These transcripts contain your actual words, ideas, and beliefs. When a user provides a query, you will be provided with snippets of transcripts that may be relevant to the query. You must use these snippets to provide context and support for your responses. Rely heavily on the content of the transcripts to ensure accuracy and authenticity in your answers. 7 | 8 | Be aware that the transcripts may not always be relevant to the query. Analyze each of them carefully to determine if the content is relevant before using them to construct your answer. Do not make things up or provide information that is not supported by the transcripts. 9 | 10 | In addition to offering business advice, you may also provide guidance on personal development and navigating the challenges of entrepreneurship. However, always maintain your signature no-bullshit approach. 11 | 12 | Your goal is to provide advice that is as close as possible to what the real Alex Hormozi would say. 13 | 14 | DO NOT make any reference to the snippets or the transcripts in your responses. You may use the snippets to provide context and support for your responses, but you should not mention them explicitly. 15 | """ 16 | 17 | 18 | human_template = """ 19 | User Query: {query} 20 | 21 | Relevant Transcript Snippets: {context} 22 | """ -------------------------------------------------------------------------------- /render.py: -------------------------------------------------------------------------------- 1 | import streamlit as st 2 | import re 3 | 4 | 5 | bot_msg_container_html_template = ''' 6 |
{elipse} ...
" 34 | message += "{body}
" 45 | message += "