# Meeting 1 In order to develop a comprehensive framework for the B2C strategy I recommend: Model: `gpt-3.5-turbo-0613` Paradigm: `Use the new ALM (Augmented Language Model) which leverages functions to increase it's actionable range.` General considerations: 1. **Implement ChatGPT Functions:** flesh out an extensive list of most needed functions for the agent and start developing by priority. 2. **Guardrails:** Use Prefix and Sufix structure for all prompts so that the agents is always aware and cannot be taken out of character so easily. 3. **Only use Vector search for specific cases:** keep in mind this makes the model dumber if using something like retrieval agent from langchain, so it wont be able to answer additional information that what it's initially given. Vector search can be abstracted througha function for the more generic purpose model. 4. **Reduce Latency with Straming:** Enable model response streaming for a more lively User Experience. This showcases the response as it's being generated so the used doesnt have a hanging screen for a couple of seconds. [example](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb) 5. **Memory and summarization:** Keeping a simple chat history and providing summarizations of previous events can significantly improve the model's context awareness. This will make the agent more capable of understanding and responding to user queries in a coherent and relevant manner. 6. **Product Database:** Consider creating a simple database (Mongo, SQL or similar) to keep track of the most recent N queries, use ChatGPT Functions to retrieve these when necessary Optional: - *Consider adding amazon affiliate links to generate additional income* role: system , content: you are.... --- # Meeting 2 **Memory Module Alternatives:** These are the memory module implementations to enhance the memory capability of a Language Learning Model (LLM): 1. **Simple Rolling Summary**: This approach involves maintaining a `summary file` that chronologically logs all previous chat interactions. The LLM can reference this file to gain understanding from past interactions. It's a straightforward method with the primary advantage of simplicity, but managing the increasing data size and format for better performance may require careful planning. ``` summarizeHistory { file ChatCompletions( mesages: [...chatHistory. Please summarize...] ) } chatHistory length >= 10000 { summarizeHistory() } ChatCompletions( mesages: [...chatHistory, ...summary] ) ``` 2. **SQL Database of products**: This strategy includes storing product data fetched from APIs like Amazon or eBay in a `structured SQL database`. Essential product details such as the `product description`, `reviews`, and other metadata are captured and stored. The LLM can retrieve and use this information efficiently. The advantage of this method is the structured nature of the stored data and its easy retrievability, but it necessitates SQL database management skills. 3. **Langchain Vector Store**: Here, the chat interaction data are transformed into `embedded vector representations` and stored in a `vector database` like `DeepLake` or `ChromaDB`. These vector representations capture the semantic nuances of the conversation and can be utilized for various purposes such as predicting future inputs or finding similar conversations. Though this method may be computationally intensive, it offers a more in-depth understanding of the interaction context. ``` - https://python.langchain.com/docs/modules/memory/ - Create a Vector store - Create the Tools for the langchain implemntation - Use the function format_tool_to_openai_function from the langchain.tools module - Start the QA chain with from langchain.chains import ConversationalRetrievalChain ``` 4. **Cached Products for Lower Latency**: By implementing a caching system, the response time of the LLM can be significantly improved. Frequently accessed product data can be stored in the cache, allowing the model to retrieve and provide this information quickly without needing to query the main database each time. This decreases latency and lessens the load on the main database, enhancing the overall system performance. Tools like `Redis` or `Memcached` can be used to implement an efficient caching system. 5. **Time-series Database**: Time-series databases like `InfluxDB` or `TimescaleDB` are especially beneficial for managing data generated over time, as is the case with most chat logs. These databases track changes over time, enabling the review of the conversation's context as it evolves. This provides the LLM with a chronological understanding, assisting in discerning temporal patterns in the interactions. The choice among these memory module implementations depends on the specific needs of your application. These methods can be used in combination to create a hybrid solution that leverages the benefits of each approach.