Skip to main content

A library for building and deploying machine learning models

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 = messages,
    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.0.3.tar.gz (6.4 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.0.3-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: freewayai-0.0.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.6

File hashes

Hashes for freewayai-0.0.3.tar.gz
Algorithm Hash digest
SHA256 3842ad4b8c2ab0bd0e4c9558e6d8053abae97cd47b555eecc520bd2da189b413
MD5 a519ef37f20443afcaf89a10e1ef30d1
BLAKE2b-256 622b8d689dabe9055a17ea312bc75adc26a35c9368d2b068921ffb6f5b098b12

See more details on using hashes here.

File details

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

File metadata

  • Download URL: freewayai-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.6

File hashes

Hashes for freewayai-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 511f21bc95faaea0884d97cce9776e9d091c0b0ab5590b66d3588594db6ec6c3
MD5 51e08c213e8a6204f2fa5d094822ef66
BLAKE2b-256 92fde73c72f2c884f62ebb3f57fbf61f6d21d2a51d4a96bfd42bdc334476b3a9

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