Skip to main content

A functionally orientated way to make prompts for speaking with LLMs

Project description

Why funkyprompt?

funkyprompt is a functional orienated library for building predictable and scalable LLM agent systems over blob storage RAG stores. Lets unpick this

  • agent systems are potetnially powerful but hard to guide
  • if you want to use your own data, you also need to organize those data
  • you need your program to scale both in terms of managed complexity and data size

Today this is tricky for a bunch of reasons and funkyprompt takes a disciplined and thoughtful approach to evaluating a new way to build data stores and a new way to write programs.

funkyprompt is a functionally orientated way to make prompts for speaking with LLMs. As LLMs and building applications such as Retrieval Augmented Generation (RAG) systems exploded in activity, the ecosystem and tooling evolved incredibly quickly. funkyprompt takes a disciplined approach to constructing applications with one or multiple agents, by adhering to existing programming patterns, particularly functional ones, to construct applications.

Rather than build entirely new types of applications and dabbling in esoteric arts like Prompt Engineering, the idea is to point LLMs at your existing codebase (or a new codebase intended for Agent systems but written the way you normally would) to build programs and reason about program flow and construction.

This will make sense as we get into then specifics. For now, ask yourself this question; what if we do not write prompts at all? What if we rely on well documented code to create zero shot or conversational agents and even multi-agent systems? No prompts. No special "agent" libraries. Just business as usual.

funkyprompt is a cloud native library in the sense that it puts the data lake and the ability to run easily on the cloud front and center. There are many utilities for building RAG stores on data lakes. This allows for testing with functions that actually do CRUD on real data at any scale. For this reasons there are two reasons why you might use funkyprompt

  1. A RAG store
  2. A funtional way to build complex agent programs

Concepts

Designed as a lightweight library it is more about principles than features. You can extend it in your own library easily. You can run it using REST or Webhooks You can run it on Kubernetes

Types and functions are important. If we cannot describe something with types or functions we dont do it at all. There is only one simple agent class and it runs in a loop ny inspecting the space of functions and constructing a plan. Simplicity is the key.

Install

pip install funkyprompt

Or you can clone the project and do the poetry stuff..

poetry install funkyprompt

Setup

In your environment you can set an OPEN_AI key to use the agents. This will allow you to run the tests on the example methods and types or your own

Stores

We provide minimal support for data stores just to test the library to test RAG functionality. The objective is not to provide a connector for everything as some libraries do but provide one example of each type of store to illustrate the concepts. We follow the philosophy that if you have your favourite stores, you can use interfaces if your own to connect them into the functions described here.

You can set the following environment variables to a local directory or an S3 directory. If you use the S3 store you also need to make sure your have set your AWS keys. You need to create whatever bucket too.

export FP_STORE_HOME
#aws stuff

You can then test the stores by running scripts to load the sample data and running some prompts

Default homes are under ./funkyprompt/stores/

fprompt query -q "What is X"

Experiments

The primary point if fprompt is to run experiments to prove patterns for predictable results. Visit the docs to learn more.

Auditing

We write all logs as EVENT in the logger You can add callbacks to the logger to send data wherever - data are usually written as structured pydantic types The sessions is always dumped to the vector store Pulsar can be used on the cluster Monologue can scrape data from logger

Buildpack

Conventions

FP uses modules in MODULE_HOME such as ops.examples or whatever you specify. All types are expected to live under this directory MODULE_HOME/NAMESPACE/TYPE Crud and methods associated with the entity can be added here We may generated _entity_crud.py which the user can update or any other ops can be added we prefix auto generated files (except for initial types) with the under score to observe that its not safe to update and re-run generators that could overwrite Docstrings format - use the helper to generate for a given function - it also validates that typing info is present Funkyprompt entity loader is fixed to the examples module but we should be able to override that - test with monologue
bump

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

funkyprompt-0.1.318.tar.gz (95.5 kB view details)

Uploaded Source

Built Distribution

funkyprompt-0.1.318-py3-none-any.whl (67.7 kB view details)

Uploaded Python 3

File details

Details for the file funkyprompt-0.1.318.tar.gz.

File metadata

  • Download URL: funkyprompt-0.1.318.tar.gz
  • Upload date:
  • Size: 95.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.10 Darwin/22.4.0

File hashes

Hashes for funkyprompt-0.1.318.tar.gz
Algorithm Hash digest
SHA256 74a564b81a12ec7c569881e5ab889e9b954d1844ab49dcf59fdd872a00336536
MD5 47f1f9bd4ef5aaacba6bfdc02832699a
BLAKE2b-256 675579ca5113cb5ed15d5e86c9c51c934c93ee05137d91a02d520ec34f8448a4

See more details on using hashes here.

File details

Details for the file funkyprompt-0.1.318-py3-none-any.whl.

File metadata

  • Download URL: funkyprompt-0.1.318-py3-none-any.whl
  • Upload date:
  • Size: 67.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.10 Darwin/22.4.0

File hashes

Hashes for funkyprompt-0.1.318-py3-none-any.whl
Algorithm Hash digest
SHA256 517496dccfe84e5726685123a2ef836436b166c13933fc5f17fb399fa6e6756c
MD5 9158eaeddc5040268928a516d296013e
BLAKE2b-256 78e24e23cc5315170fd1ebe6dbd13cdefc2da98e99b97a6063a9fef804c984d8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page