1
+
2
+
1
3
<p align =" center " >
2
4
<p align =" center " >
3
5
<a href="https://promptsail.com/?utm_source=github&utm_medium=logo" target="_blank">
4
- <img src="https://bucket.mlcdn.com/a/1777/1777896/ images/c2ba3a2cf624d3343a98cbb35f1d02dd373d8000 .png" alt="Prompt Sail" width="390" height="91">
6
+ <img src="docs/assets/ images/Logo-teal_black .png" alt="Prompt Sail" width="390" height="91">
5
7
</a>
6
8
</p >
7
9
<p align =" center " >
8
- Open Source LLM prompt management and monitoring.
10
+ LLM’s proxy for prompt and response governance, monitoring, and analysis .
9
11
</p >
10
12
</p >
11
13
14
+ > ⚠️ ** Prompt Sail is currently in Development** : Expect breaking changes and bugs! Feedback and contributions are welcome. Please see the [ Contributing Guide] ( CONTRIBUTING.md ) for more information.
15
+
16
+ <p align =" center " >
17
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
18
+ <img alt =" GitHub License " src =" https://img.shields.io/github/license/promptsail/prompt_sail " >
19
+ <img alt =" GitHub Actions Workflow Status " src =" https://img.shields.io/github/actions/workflow/status/promptsail/prompt_sail/docker-publish.yml?label=Build%20and%20Publish%20Docker " >
20
+ <img alt =" GitHub commit activity " src =" https://img.shields.io/github/commit-activity/m/promptsail/prompt_sail " />
21
+ <img alt =" Github Last Commit " src =" https://img.shields.io/github/last-commit/promptsail/prompt_sail " />
22
+ <img alt =" Github Contributors " src =" https://img.shields.io/github/contributors/promptsail/prompt_sail " />
23
+ <img alt =" GitHub closed issues " src =" https://img.shields.io/github/issues-closed/promptsail/prompt_sail " />
24
+
25
+ </p >
26
+
27
+
12
28
## What is Prompt Sail?
13
29
14
- Prompt Sail is a proxy for Large Language Models (LLMs) such as GPT-3, ChatGPT, DialoGPT, etc.
15
- that allows you to record prompts and responses, analyze the output, compare the outcome over time,
16
- track trends and changes across various models and their versions.
30
+ 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.
31
+
32
+ To learn more about Prompt Sail’s features and capabilities, see
33
+
34
+ * [ Documentation] ( https://promptsail.github.io/prompt_sail/ ) .
35
+
36
+ * [ Examples] ( https://github.com/PromptSail/prompt_sail/tree/main/examples )
37
+ * [ OpenAI SDK -> OpenAI API] ( /examples/openai_sdk_openai.ipynb )
38
+ * [ Langchain SDK -> OpenAI API] ( /examples/langchain_openai.ipynb )
39
+ * [ OpenAI SDK -> Azure OpenAI] ( /examples/openai_sdk_azure_openai.ipynb )
40
+ * [ Langchain SDK -> Azure OpenAI] ( /examples/langchain_azure_openai.ipynb )
41
+ * [ Langchain SDK -> Azure OpenAI Ada embeddings] ( /examples/langchain_azure_oai_embeddings.ipynb )
17
42
18
- To learn more about Prompt Sail’s features and capabilities, see our [ product page ] ( https://promptsail.com/ ) .
43
+ <!-- * [API Reference ](https://promptsail.github.io/prompt_sail/api/). -->
19
44
20
45
## Getting started
21
46
22
47
The simplest way to try Prompt Sail is to create a project on https://try.promptsail.com and integrate it with
23
48
your code.
24
49
25
- If you prefer to install and manage Prompt Sail yourself, you can download a docker image and run it locally.
50
+ If you prefer to install and manage Prompt Sail yourself, you can build or download a docker image and run it locally.
26
51
27
- ## Run Prompt Sail locally
52
+ ## Run Prompt Sail locally via Docker Compose
28
53
29
54
To try out Start Prompt on your own machine, we recommend using docker-compose. Docker images are available from ...
30
55
@@ -39,112 +64,96 @@ cd prompt_sail
39
64
40
65
41
66
42
- ### Linux machine
67
+ ### Build docker images
43
68
44
- 1 . Since Prompt Sail relies on subdomains, first you should update your ` /ect/hosts ` file with the following lines:
45
-
46
- ``` bash
47
- 127.0.1.1 project1.promptsail.local
48
- 127.0.1.1 project2.promptsail.local
49
- 127.0.1.1 promptsail.local
50
- ```
51
-
52
- 3 . Build and run the docker image:
69
+ Build and run the docker image:
53
70
54
71
``` bash
55
72
docker-docker-compose up --build
56
73
```
57
74
58
- If you want to run the code locally:
59
-
60
- Create ` .env ` file in the root project directory with the following content:
61
75
62
- ```
63
- OPENAI_API_KEY="[your-openai-api-key]"
64
- MONGO_URL="mongodb://root:password@localhost:27017"
65
- BASE_URL="http://promptsail.local:8000"
66
- ```
67
-
68
- Make sure you have Poetry installed, then:
69
- ``` bash
70
- poetry install
71
- poetry shell
72
- ```
73
-
74
- Make sure you have ` make ` installed, then:
75
-
76
- ``` bash
77
- make run # to start docker-compose
78
- ```
79
-
80
- ``` bash
81
- cd src
82
- python main.py # to run the code
83
- ```
84
-
85
- ### Windows 11 machine
86
-
87
- 1 . Since Prompt Sail relies on subdomains, first you should update your system ` host `
88
- ```
89
- notepad C:\Windows\System32\Drivers\etc\hosts
90
- ```
91
- file with the following lines:
92
-
93
-
94
- ``` bash
95
- 127.0.1.1 project1.promptsail.local
96
- 127.0.1.1 project2.promptsail.local
97
- 127.0.1.1 promptsail.local
98
- ```
76
+ ### Create a project
99
77
78
+ Navigate to http://localhost:80 and add you AI provider of choice.
100
79
101
- 2 . Build and run the docker image:
102
80
103
- ``` bash
104
- docker-compose up --build
105
- ```
81
+ ### Modify your code to use Prompt Sail proxy
106
82
83
+ To use Prompt Sail with ` openai ` Python library, you need to set ` OPENAI_API_BASE ` environment variable, or
84
+ modify ` openai.api_base ` parameter to point to your Prompt Sail project.
107
85
86
+ ``` python
87
+ from openai import OpenAI
88
+ import os
89
+ from dotenv import load_dotenv
90
+ from pprint import pprint
108
91
92
+ load_dotenv()
109
93
110
- ### Create a project
94
+ openai_key = os.getenv(" OPENAI_API_KEY" )
95
+ openai_org_id = os.getenv(" OPENAI_ORG_ID" )
111
96
112
- Navigate to http://promptsail.local , feel free to browse projects.
113
- Creating a new project via UI is not yet implemented, stay tuned for new commits.
97
+ api_base = " http://localhost:8000/project1/openai/"
114
98
115
- ### Modify your code to use Prompt Sail proxy
99
+ ps_client = OpenAI(
100
+ base_url = api_base,
101
+ api_key = openai_key,
102
+ )
116
103
117
- To use Prompt Sail with ` openai ` Python library, you need to set ` OPENAI_API_BASE ` environment variable, or
118
- modify ` openai.api_base ` parameter to point to your Prompt Sail project.
119
- ``` python
120
- import openai
121
- openai.api_base = " http://[your-project-id].promptsail.local:8000"
122
- openai.ChatCompletion.create(
104
+ response = ps_client.chat.completions.create(
123
105
model = " gpt-3.5-turbo" ,
124
- messages = [{" role" : " user" , " content" : " Explaining the meaning of life in one sentence." }],
106
+ messages = [
107
+ {
108
+ " role" : " system" ,
109
+ " content" : " You are a poetic assistant, skilled in explaining complex programming concepts with creative flair." ,
110
+ },
111
+ {
112
+ " role" : " user" ,
113
+ " content" : " Compose a poem that explains the concept of recursion in programming." ,
114
+ },
115
+ ],
125
116
)
117
+
118
+ pprint(response.choices[0 ].message)
126
119
```
127
120
128
121
Using Prompt Sail with ` langchain ` is similar:
129
122
``` python
130
- from langchain.llms import OpenAI
131
- llm = OpenAI(
132
- model_name = " text-davinci-003" ,
133
- openai_api_base = " http://[your-project-id].promptsail.local:8000" ,
123
+ from langchain.chat_models import ChatOpenAI
124
+ from langchain.prompts.chat import (
125
+ ChatPromptTemplate,
126
+ HumanMessagePromptTemplate,
127
+ SystemMessagePromptTemplate,
134
128
)
135
- llm(" Explaining the meaning of life in one sentence." )
129
+ from langchain.schema import HumanMessage, SystemMessage
130
+
131
+ haiku_prompt = [
132
+ SystemMessage(
133
+ content = " You are a poetic assistant, skilled in explaining complex programming concepts with creative flair." ,
134
+ ),
135
+ HumanMessage(
136
+ content = " Compose a haiku that explains the concept of recursion in programming." ,
137
+ ),
138
+ ]
139
+ chat = ChatOpenAI(
140
+ temperature = 0.9 ,
141
+ openai_api_key = openai_key,
142
+ openai_organization = openai_org_id,
143
+ model = " gpt-3.5-turbo-1106" ,
144
+ )
145
+
146
+ chat(haiku_prompt)
136
147
```
137
148
138
- ### Analyzing the prompts and responses
149
+ ## Contact
139
150
140
- After running your LLM code, navigate back to your project page and see the prompt and response recorded.
151
+ - Bugs & requests: file a GitHub ticket
152
+ - For business inquiries: email contact@promptsail.com .
153
+ - Our website: [ https://promptsail.com ] ( https://promptsail.com )
141
154
142
- ## Testing
143
155
144
- To run tests, simpy run ` make test ` .
156
+ ## License
145
157
146
- ## Building the docker image
158
+ Prompt Sail is free and open source, under the [ MIT license ] ( LICENSE ) .
147
159
148
- ``` bash
149
- make build
150
- ```
0 commit comments