Git Product home page Git Product logo

promptsail / prompt_sail Goto Github PK

View Code? Open in Web Editor NEW
39.0 4.0 0.0 23.33 MB

Open Source LLM proxy that transparently captures and logs all interactions with LLM API

Home Page: http://promptsail.com/

License: MIT License

Python 2.89% HTML 93.72% Dockerfile 0.04% Makefile 0.01% Procfile 0.01% JavaScript 0.08% TypeScript 2.50% CSS 0.69% Sass 0.02% Roff 0.03% Shell 0.01%
llm llm-prompting prompt-engineering prompt-management prompt-manager prompt-tool llm-proxy

prompt_sail's Introduction

Prompt Sail

LLMโ€™s proxy for prompt and response governance, monitoring, and analysis. ๐Ÿ“Š๐Ÿ”

โš ๏ธ Prompt Sail is currently in Development: Expect breaking changes and bugs! Feedback and contributions are welcome. Please see the Contributing Guide for more information.

GitHub License GitHub Actions Workflow Status GitHub commit activity Github Last Commit Github Contributors GitHub closed issues

What is Prompt Sail?

Prompt Sail is a proxy for Large Language Models (LLMs) API's such as OpenAI GPT models, Azure OpenAI, Anthropic Clude etc. that allows you to record prompts and responses, analyze costs, generation speed, compare and track trends and changes across various models and projects over time.

Prompt Sail dashboard

To learn more about Prompt Sailโ€™s features and capabilities, see

Getting started ๐Ÿš€

The easiest way is to test our demo at https://try-promptsail.azurewebsites.net/ (every new deployment erases the database)

Check out the documentation how to run PromptSail locally via docker.

Run Prompt Sail locally via Docker Compose ๐Ÿณ

To try out Start Prompt on your own machine, we recommend using docker-compose.

Requirements ๐Ÿ“‹

  • installed docker and docker-compose on your machine Windows | Mac | Linux
  • git clone repository and navigate to main directory
git clone https://github.com/PromptSail/prompt_sail.git
cd prompt_sail

Run docker images ๐Ÿ—๏ธ

Build and run the docker image:

docker-compose -f docker-compose-build.yml up --build

Pull and run the Docker images from GHCR:

docker-compose -f docker-compose.yml up

Create a project ๐Ÿ“

Navigate to http://localhost:80 and add you AI provider of choice.

Modify your code to use Prompt Sail proxy ๐Ÿ‘จโ€๐Ÿ’ป

To use Prompt Sail with openai Python library, you need to set OPENAI_API_BASE environment variable, or modify openai.api_base parameter to point to your Prompt Sail project.

from openai import OpenAI
import os
from dotenv import load_dotenv
from pprint import pprint

load_dotenv()

openai_key = os.getenv("OPENAI_API_KEY")
openai_org_id = os.getenv("OPENAI_ORG_ID")

api_base = "http://localhost:8000/project1/openai/"

ps_client = OpenAI(
    base_url=api_base,
    api_key=openai_key,
)

response = ps_client.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[
        {
            "role": "system",
            "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.",
        },
        {
            "role": "user",
            "content": "Compose a poem that explains the concept of recursion in programming.",
        },
    ],
)

pprint(response.choices[0].message)

Using Prompt Sail with langchain is similar:

from langchain.chat_models import ChatOpenAI
from langchain.prompts.chat import (
    ChatPromptTemplate,
    HumanMessagePromptTemplate,
    SystemMessagePromptTemplate,
)
from langchain.schema import HumanMessage, SystemMessage

haiku_prompt = [
    SystemMessage(
        content="You are a poetic assistant, skilled in explaining complex programming concepts with creative flair.",
    ),
    HumanMessage(
        content="Compose a haiku that explains the concept of recursion in programming.",
    ),
]
chat = ChatOpenAI(
    temperature=0.9,
    openai_api_key=openai_key,
    openai_organization=openai_org_id,
    model="gpt-3.5-turbo-1106",
)

chat(haiku_prompt)

Contact ๐Ÿ“ž

License ๐Ÿ“œ

Prompt Sail is free and open source, under the MIT license.

prompt_sail's People

Contributors

bklzn avatar ksopyla avatar pgorecki avatar sliwaszymon avatar wiolagreen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

prompt_sail's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.