Package: chronological
ChronologyChronology is a library that enables users of OpenAI's GPT-3 language model to more easily build complex language-powered applications.It provides a simple and intuitive interface for working with GPT-3.We built this at OthersideAI to help mitigate some of the monotonous work we had to do when developing with GPT-3. Our library has the following features:Asynchronously call GPT-3, enabling multiple prompts to generate at the same timeEasy creation and modification of promptsChain prompts together, feeding output from one or multiple prompts into another prompt, allowing for highly-complex systems to be built quicklyWe built this library to be as intuitive as possible. There are no complicated concepts to master.Installationchronology is hosted on PyPI.Chronology is supported on Python 3.6 and above.To install chronology:pip install chronologicalThis project also depends on the following packages:openai-apipython-dotenvloguruasyncioUsageAfter you have downloaded the package, create a.envfile at the root of your project and put your OpenAI API key in as:OPENAI_API_KEY = "MY_API_KEY"You now have a few options. You can use the UI to generate the chain or you can use the API directly.Using ChronologyUIHere is aLoom videoshowing how to use the UI with the Pythonchronologypackage.Using the API DirectlymainMain function that runs logic. Accepts a function implemented on your end!fetch_max_search_docFetch document value with max score. Wrapper for OpenAI API Search.Optional:min_score_cutoff = if maximum score is less than cutoff, None will be returned. Defaults to -1full_doc = return whole response with max, but doesn't grab doc for you. Defaults to False. [doc, doc.index, doc.score]raw_completionWrapper for OpenAI API completion. Returns raw result from GPT-3.cleaned_completionWrapper for OpenAI API completion. Returns whitespace trimmed result from GPT-3.gatherRun methods in parallel (they don't need to wait for each other to finish).Requires method argumets to be async.Example: await gather(fetch_max_search_doc(query_1, docs), fetch_max_search_doc(query_2, docs))read_promptLooks in prompts/ directory for a text file. Pass in file name only, not extension.Example: prompts/hello-world.txt -> read_prompt('hello-world')add_new_lines_startAdd N new lines to the start of a string.add_new_lines_endAdd N new lines to the end of a string.append_promptAdd new content to the end of a string.prepend_promptAdd new content to the start of a string.set_api_keySet your OpenAI API key in the code.ContributingChronology & ChronologyUI are both open source!This project is an evolving use case and we welcome any contribution or feedback.Open Bouties:adding all the fields the OpenAI Python API accepts to Chronologyadding a test suite that calls different length chainsextendingfetch_max_search_docto have smarter logic around minimium scoresmakegatherrun faster, usingthreadsLearn MoreChronology is the backbone ofhttps://OthersideAI.com. We use it to chain prompt calls and asyncronously call GPT-3. Our application is highly complex, and has many steps. Chronology allows us to parallelize those steps, significantly cutting down the time it takes to generate an email.To learn more about OthersideAI, take a look at the following resources:Our HomepageOur Twitter