Package: ategpt
ATE-GPT: A Lightweight Python Library for Enhanced ThinkingATEGPT ("Ask, Think, Evaluate" powered by GPT) is a true thought partner, enhancing your thinking with Chain of Thought behavior.This module is intended to be very lightweight, relying only on the openai API and some simple prompt engineering techniques to guide a GPT-based LLM through a comprehensive thought process.Table of ContentsIntroductionInstallationDependenciesUsageQuick OverviewBare-Bones CLITasks in the ATE ProcessAdvanced UsageExplicitly Define Your OpenAI API KeyUse a Different ModelTweak the TemperatureAccess Intermediate StepsAccess Final ThoughtThoughtProcessObjectAttributesMethodsThinkProcess.think()ThinkProcess.evaluate()ThinkProcess.ask()ThinkProcess.end()Helper MethodsExamplesExample 1: Hard ProblemsExample 2: Simple ProblemsContributingLicenseAcknowledgementsIntroductionATE-GPT is a simple but powerful tool for those seeking to refine their thought processes and arrive at well-informed conclusions. It follows a structured approach consisting of tasks like asking questions, generating thoughts, evaluating progress, and providing final insights, all designed to help you reach your desired end goal effectively.InstallationYou can install ATE-GPT using pip:pipinstallategptDependenciesATE-GPT depends only on theOpenAI Python library (v0.28.0+), which is included in the install of ATE-GPT.UsageIt's easy to use ATE-GPT!Here's a quick overview of how to use ATE-GPT in your Python projects:importategpt# Define your end goalgoal="I want to accomplish [your goal here]."# Create an instance of the ThoughtProcess classthought_process=ategpt.ThoughtProcess(goal)# Start the thought processthought_process.think()# Print the final thoughtprint(thought_process.final_thought)Note: With the default parameters, the thought process will print each step to the command line, up to and including the final step.Bare-Bones CLIYou can also choose to clone this repository and runategpt.pyas an executable in order to use ATE-GPT's bare-bones CLI. You can use this CLI to kick off a single thought process directly in the command line, similar to OpenAI's ChatGPT chatbot, but with the added benefits of the ATE thought process.Example CLI usage:$ python ategpt.py
Hello, I am ATE-GPT ("Ask, Think, Evaluate" powered by GPT), your AI thought partner! What should we think about? Please state your desired end goal below.

MY END GOAL: I want to know how to build an off-grid cabin in the woods with minimal tools and no experience.

THOUGHT: Drawing upon the principles of survival and minimalist living, one might consider a small, simple log cabin design. This would require minimal......and so on...Tasks in the ATE ProcessATE-GPT follows a structured approach to help you refine your thoughts effectively.Here are the key tasks it performs and a brief summary of the prompt OpenAI receives to complete it:THINK: Generate a new thought that brings you closer to achieving your end goal. Consider the context of the ongoing thought process carefully and be creative in your thinking.EVALUATE: Evaluate the ongoing thought process and determine the next step. ATE-GPT can suggest whether to ask a question, generate another thought, or end the process.ASK: Pose a question about the current topic that, if answered, could lead you closer to accomplishing your end goal.END: Conclude the thought process with a succinct final thought that reflects the overall context and accomplishes the end goal.Advanced UsageThe behavior of ATE-GPT can be modified to suit the needs of your project. Below are some examples of advanced ways of modifying ATE-GPT.Explicitly define your OpenAI API KeyBy default, ATE-GPT look for an environment variable calledOPENAI_API_KEY. If you choose to manage your API keys in a different way, you may define your API Key when initializing theThoughtProcessobject.fromategptimportThoughtProcessmy_key='myApiKey1234'thought_process=ThoughtProcess(api_key=my_key)Use a different modelATE-GPT supports allgpt-3.5andgpt-4models from OpenAI.gpt-4is the default model used.fromategptimportThoughtProcessthought_process=ThoughtProcess(model='gpt-3.5-turbo-16k')Tweak the temperatureBy default, ATE-GPT usees a temperature of 0.5 for all completions (except for theevaluationstep, which uses a temperature of 0, which is recommended for consistent outputs from theevaluationstep). Temperatures closer to 0 will be less variable, while temperatures closer to 2 can be so variable as to be incomprehensible.fromategptimportThoughtProcessthought_process=ThoughtProcess(temp=0.7)Access Intermediate StepsIf you wish to access the intermediate steps, you can reference theintermediate_stepsattribute of theThoughtProcessobject.fromategptimportThoughtProcessthought_process=ThoughtProcess(temperature=0.7)thought_process.think()forstepinthought_process.intermediate_steps:print(step)Access Final ThoughtAfter running the thought process, you can access thefinal_thoughtattribute of theThoughtProcessobject. This attribute represents a concise and well-informed summary that encapsulates the outcome of the thought process. It provides you with a clear answer that accomplishes the stated end goal, based on the structured thinking and analysis performed by ATE-GPT.fromategptimportThoughtProcessthought_process=ThoughtProcess(temperature=0.7)thought_process.think()print(thought_process.final_thought)ThoughtProcessObjectTheThoughtProcessobject serves as the core mechanism responsible for keeping track of the ongoing thought process and determining which task is appropriate at a given moment in the thought process.ParametersYou can customize theThoughtProcessobject's behavior by including any of the following parameters as keyword arguments when initializing the object:AttributeTypeDefaultDescriptiongoalstrNo defaultRequired parameter, represents the desired end-goal of this thought process.max_stepsint10Maximum number of steps ATE-GPT will take before returning a final thought.api_keystrOPENAI_API_KEYenvironment variableYourOpenAI API keydebugboolTrueIf True, prints out each step of the thought process to the command linemodelstr'gpt-4'Name of the OpenAI GPT modeltempfloat0.5Floating point number between 0 and 2, represents the temperature parameter used for each OpenAI completion in the thought process (except theevaluatestep, which always uses 0)MethodsThoughtProcess.think()Generates a thought, adds it to the ongoing context for this thought process, then moves on to the next step.ThoughtProcess.evaluate()Evaluates the thought process, and recommends the next step, adds it to the ongoing context for this thought process, then moves on to the next step.ThoughtProcess.ask()Asks a question to further the thought process, adds it to the ongoing context for this thought process, then moves on to the next step.ThoughtProcess.end()Generates a single final thought to sum up the thought process and achieve the end goal, adds it to the context for this thought process, then returns without moving on to the next step.Helper MethodsThese methods are each responsible for a minor task within the ATE process. They are included here for reference, but you should rarely, if ever, need to access them directly.ThoughtProcess._get_next_step(text)Helper function for determining the next step based on the final word of the ongoing thought process.If thought process has reached max_steps or the latest evaluation returns "END", then thought process ends.If latest evaluation returns "THINK", then a new thought is produced.If latest evaluation returns "ASK", then a new question is asked.Otherwise, if latest step was not an evaluation, then the thought process is evaluated to determine the next step.ThoughtProcess._add_context(prefix, completion)Adds the provided prefix and completion to the context of the ongoing thought process as well as the list of intermediate steps or the final_thought, depending on how many steps remain.eg. "THOUGHT: This is an example thought."ExamplesHere are two examples that showcase the flexibility of ATE-GPT.Example 1: Hard ProblemsATE-GPT is capable of thinking through complex problems and bringing in interdisciplinary thinking to accomplish the end goal.fromategptimportThoughtProcessend_goal="I need to know the best activities to do with my 9-month-old baby in his last wake-window of the day (3pm to 6pm)."thought_process=ThoughtProcess(end_goal)thought_process.think()Running the script above, you should expect the output to look something like this:THOUGHT: Drawing inspiration from the field of early childhood development, it's noted that sensory play is highly beneficial for babies around this age. Given the time window, you could introduce a 'sensory bin' activity in a controlled environment. This could include different textures (soft, rough, squishy), shapes, and colors to stimulate your baby's senses. Additionally, considering the proximity to bedtime, it would be beneficial to include calming activities. Reading a picture book together or playing with soft toys could serve as a wind-down routine, preparing your baby for sleep.


EVAL: THINK


THOUGHT: Building on the idea of sensory play and calming activities, we could integrate elements from music therapy, recognized for its soothing and developmental benefits. During this wake-window, introducing a 'music and movement' activity could be beneficial. This could involve playing soft, rhythmic music and encouraging your baby to move along with it. This not only develops their motor skills but also introduces them to the world of sounds. As we approach closer to bedtime, transitioning from active music to lullabies could help wind down the energy, aiding in the transition to sleep.


EVAL: THINK


THOUGHT: Drawing from the discipline of cognitive psychology, we know that routine and predictability are important for a baby's sense of security. Therefore, incorporating a consistent routine into this wake-window could be beneficial. This could involve a sequence of activities such as sensory play, followed by the 'music and movement' activity, and then winding down with reading a book or playing with soft toys. The predictable sequence of activities could provide a sense of comfort and security for your baby, making the transition to sleep smoother. Furthermore, it could also aid in cognitive development as your baby begins to understand the concept of sequences and routines.


EVAL: THINK


THOUGHT: Drawing from the discipline of physical development and the concept of "tummy time," it could be beneficial to incorporate some light physical activity in the early part of this wake-window. This could involve placing your baby on their tummy and encouraging them to lift their head or move their arms. This can help strengthen their neck, shoulder, and arm muscles. Following this, you could transition into the sensory play activity, then the 'music and movement' activity, and finally wind down with reading a book or playing with soft toys. This sequence not only provides a variety of stimulating activities for your baby but also gradually transitions from physical to cognitive to calming activities, preparing your baby for sleep.


EVAL: END


FINAL THOUGHT: Based on our thorough exploration of early childhood development, cognitive psychology, music therapy, and physical development, the optimal activities for your 9-month-old baby in the last wake-window of the day (3pm to 6pm) can be summarized as follows:

Begin with light physical activity, such as 'tummy time', to help strengthen your baby's neck, shoulder, and arm muscles. Next, transition into a sensory play activity, using a sensory bin with a variety of textures, shapes, and colors. This will stimulate your baby's senses and keep them engaged.

Following sensory play, introduce a 'music and movement' activity. Play soft, rhythmic music, and encourage your baby to move along with it, which will develop their motor skills and introduce them to the world of sounds.

Finally, wind down with calming activities, such as reading a picture book or playing with soft toys. This will serve as a soothing routine, preparing your baby for sleep.

Remember, maintaining a consistent sequence of these activities can provide a sense of comfort and security for your baby, aiding in cognitive development and making the transition to sleep smoother.Example 2: Simple ProblemsATE-GPT can also quicklky identify when a question is simple and answer it simply.fromategptimportThoughtProcessend_goal="What is (5 * 5) - 30?"thought_process=ThoughtProcess(end_goal)thought_process.think()Running the script above, you should expect the output to look something like this:THOUGHT: Let's use the basic principles of arithmetic to solve this problem. If we start by performing the multiplication operation in the problem, 5 times 5 equals 25. If we then subtract 30 from this result, we get -5. Therefore, (5 * 5) - 30 equals -5.


EVAL: END


FINAL THOUGHT: Reflecting on our thought process, we employed basic arithmetic principles to solve the problem at hand. We first performed the multiplication, 5 times 5, which resulted in 25. We then subtracted 30 from this result, leading us to the final result of -5. Therefore, the answer to (5 * 5) - 30 is -5. This simple and straightforward approach allowed us to achieve our end goal effectively.ContributingContributions to improve ATE-GPT are welcome! If you find any issues or want to suggest enhancements, please submit an issue or pull request in theGitHub repository.LicenseThis project is licensed under the MIT License.AcknowledgementsATE-GPT was inspired by the need to utilize Chain-of-Thought techniques without relying heavily on third-party libraries and without involving obtuse and unnecessary abstractions.Happy thinking with ATE-GPT!