Skip to main content

A new open-standard specification for LLM-backed systems and an SDK for building on it

Project description

FreewayAI

Welcome to FreewayAI: a new open-standard specification for LLM-backed systems

Freeway is meant to provide a simple, flexible, enxtensible and lightweight standard for managing prompt templates, database query templates, user input points, and LLM-backed system diagrams.

The units of FreewayAI

The unit elements of Freeway are as follows:

  • Prompt Templates
  • Database Query Templates
  • User Inputs

These units can then be used to construct a diagram of a system structure, to indicate the general flow of data.
We know that systems built on LLMs are full of json parsing, for loops, if statements, and regexes. We just think that you should focus on outlining the LLM-specific components of a system.

We also believe that prompt templates should be managed out of code, where they can be edited on their own lifecycle.

Installation

pip install freewayai

Usage

Project Structure

system_configs/
├─ my_system/
│  ├─ database_templates.json
│  ├─ prompt_templates.json
│  ├─ system_structure.json
│  ├─ user_inputs.json
├─ my_second_system/
│  ├─ database_templates.json
│  ├─ prompt_templates.json
│  ├─ system_structure.json
│  ├─ user_inputs.json
index.py

Example prompt_templates.json file

{
  "templates": {
    "pirate_talk": {
      "prompt_id": "pirate_talk",
      "prompt_template": "Respond to this question from the user but talk like a pirate: {question}. Answer: ",
      "variables": [
        {
          "name": "question",
          "source": "user"
        }
      ]
    },
    "shakespeare_talk": {
      "prompt_id": "shakespeare_talk",
      "prompt_template": "Respond to this question from the user but talk like Shakespeare: {question}. Answer: ",
      "variables": [
        {
          "name": "question",
          "source": "user"
        }
      ]
    },
  }
}

Example SDK Usage

from openai import OpenAI
from freewayai import LLMSystem

SYSTEM_LOCATION = "system_configs/"

my_system = LLMSystem(SYSTEM_LOCATION, "my_system")

variables = {
  "question": input()
}

pirate_prompt = my_system.get_formatted_prompt("pirate_talk", variables)
formatted_pirate_prompt = pirate_prompt.to_openai()

client = OpenAI()
completion = client.chat.completions.create(
    model="gpt-3.5-turbo-0125",
    messages = formatted_pirate_prompt,
    temperature=0.2
)

print(completion.choices[0].message.content)

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

freewayai-0.1.3.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

freewayai-0.1.3-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file freewayai-0.1.3.tar.gz.

File metadata

  • Download URL: freewayai-0.1.3.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for freewayai-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6c5945179287368134ac955f6760e664f2591a5cfe0c022297de9e7f875e520b
MD5 0f08675d3b26dddd8ad3117dbee6f1fd
BLAKE2b-256 32a0016a7aca3ddf8588b98745059dbf35a3f9136d279e08ddfe81e10e405606

See more details on using hashes here.

File details

Details for the file freewayai-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: freewayai-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for freewayai-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 655e0d422bbf9f22b67515977aa8fbc42ac7a8c319346687828d95fdbc8dad27
MD5 a4db89497717696590bc9b2279200d61
BLAKE2b-256 d98b16af617029eb4e6091a60be4268afcc0864f033579d40a37181f093b3f4b

See more details on using hashes here.

Supported by

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