1
- # Promptix
1
+ # Promptix 🧩
2
2
3
3
[ ![ PyPI version] ( https://badge.fury.io/py/promptix.svg )] ( https://badge.fury.io/py/promptix )
4
4
[ ![ License: MIT] ( https://img.shields.io/badge/License-MIT-yellow.svg )] ( https://opensource.org/licenses/MIT )
5
5
[ ![ Python Versions] ( https://img.shields.io/pypi/pyversions/promptix.svg )] ( https://pypi.org/project/promptix/ )
6
6
[ ![ PyPI Downloads] ( https://static.pepy.tech/badge/promptix )] ( https://pepy.tech/projects/promptix )
7
7
8
- A Python library for managing and using prompts with Promptix Studio integration. Promptix makes it easy to manage, version, and use prompts in your applications with a built-in web interface .
8
+ ** Promptix ** is a powerful, local-first prompt management system that brings ** version control ** , ** dynamic templating ** , and a ** visual studio interface ** to your LLM workflows .
9
9
10
- ## Features
10
+ ## 🌟 Why Promptix?
11
11
12
- - 🎯 ** Built-in Promptix Studio** - Visual prompt management interface (access via ` promptix studio ` )
13
- - 🔄 ** Version Control** - Track changes with live/draft states for each prompt
14
- - 🔌 ** Simple Integration** - Easy-to-use Python interface
15
- - 📝 ** Variable Substitution** - Dynamic prompts using ` {{variable_name}} ` syntax
16
- - 🤖 ** LLM Integration** - Direct integration with OpenAI and other LLM providers
17
- - 🏃 ** Local First** - No external API dependencies
18
- - 🎨 ** Web Interface** - Edit and manage prompts through a modern UI
19
- - 🔍 ** Schema Validation** - Automatic validation of prompt variables and structure
12
+ Managing prompts across multiple applications, models, and use cases can quickly become chaotic. Promptix brings order to this chaos:
20
13
21
- ## Installation
14
+ - ** No more prompt spaghetti** in your codebase
15
+ - ** Version and test prompts** with live/draft states
16
+ - ** Dynamically customize prompts** based on context variables
17
+ - ** Edit and manage** through a friendly UI with Promptix Studio
18
+ - ** Seamlessly integrate** with OpenAI, Anthropic, and other providers
22
19
23
- ``` bash
24
- # Install from PyPI
25
- pip install promptix
20
+ ## ✨ Key Features
21
+
22
+ ### 🎯 Dynamic Prompt Generation
23
+ Create versatile prompts with Promptix's templating system, allowing for context-aware adjustments:
24
+
25
+ ``` python
26
+ support_prompt = Promptix.get_prompt(
27
+ prompt_template = " CustomerSupport" ,
28
+ # These variables dynamically modify the prompt
29
+ department = " Billing" ,
30
+ customer_tier = " Premium" ,
31
+ issue_type = " refund request" ,
32
+ agent_name = " Alex"
33
+ )
26
34
```
27
35
28
- ## Quick Start
36
+ ### 🔄 Version Control Built-in
37
+ Keep track of prompt iterations and test new versions without breaking production:
38
+
39
+ ``` python
40
+ # Get the latest live version (for production)
41
+ live_prompt = Promptix.get_prompt(" CustomerSupport" )
29
42
30
- 1 . Launch Promptix Studio to manage your prompts:
43
+ # Test a new draft version in development
44
+ draft_prompt = Promptix.get_prompt(
45
+ prompt_template = " CustomerSupport" ,
46
+ version = " v2"
47
+ )
48
+ ```
49
+
50
+ ### 🎨 Promptix Studio
51
+ Manage prompts through a clean web interface by simply running:
31
52
32
53
``` bash
33
54
promptix studio
34
55
```
35
56
36
- This opens Promptix Studio in your default browser at ` localhost:8501 ` .
37
-
38
- 2 . Use prompts in your code:
57
+ ### 🛠️ Fluent Builder API
58
+ Create sophisticated prompt configurations with an intuitive builder pattern:
39
59
40
60
``` python
41
- from promptix import Promptix
42
-
43
- # Simple prompt with variables
44
- prompt = Promptix.get_prompt(
45
- prompt_template = " Greeting" ,
46
- user_name = " John Doe"
47
- )
48
- print (prompt) # Output: Hello John Doe! How can I help you today?
49
-
50
- # Advanced prompt with multiple variables
51
- support_prompt = Promptix.get_prompt(
52
- prompt_template = " CustomerSupport" ,
53
- user_name = " Jane Smith" ,
54
- issue_type = " password reset" ,
55
- technical_level = " intermediate" ,
56
- interaction_history = " 2 previous tickets about 2FA setup"
61
+ config = (
62
+ Promptix.builder(" CustomerSupport" )
63
+ .with_customer_name(" Jane Doe" )
64
+ .with_department(" Technical Support" )
65
+ .with_priority(" high" )
66
+ .with_tool(" ticket_history" ) # Enable specific tools
67
+ .with_tool_parameter(" ticket_history" , " max_tickets" , 5 )
68
+ .with_memory(conversation_history)
69
+ .build()
57
70
)
58
71
```
59
72
60
- ## OpenAI Integration
61
-
62
- Promptix provides seamless integration with OpenAI's chat models:
73
+ ### 🤖 Multi-Provider Support
74
+ Send your prompts to any LLM provider while maintaining a consistent interface:
63
75
64
76
``` python
65
- from promptix import Promptix
66
- import openai
77
+ # OpenAI integration
78
+ openai_config = Promptix.builder(" AgentPrompt" ).build()
79
+ openai_response = openai_client.chat.completions.create(** openai_config)
67
80
68
- client = openai.OpenAI()
81
+ # Anthropic integration
82
+ anthropic_config = (
83
+ Promptix.builder(" AgentPrompt" )
84
+ .for_client(" anthropic" )
85
+ .build()
86
+ )
87
+ anthropic_response = anthropic_client.messages.create(** anthropic_config)
88
+ ```
69
89
70
- # Prepare model configuration with conversation memory
71
- memory = [
72
- {" role" : " user" , " content" : " I'm having trouble resetting my password" },
73
- {" role" : " assistant" , " content" : " I understand you're having password reset issues. Could you tell me what happens when you try?" }
74
- ]
90
+ ### 🧠 Context-Aware Prompting
91
+ Adapt prompts based on dynamic conditions to create truly intelligent interactions:
75
92
76
- model_config = Promptix.prepare_model_config(
93
+ ``` python
94
+ # Prompt adapts based on user context
95
+ prompt = Promptix.get_prompt(
77
96
prompt_template = " CustomerSupport" ,
78
- user_name = " John Doe" ,
79
- issue_type = " password reset" ,
80
- technical_level = " intermediate" ,
81
- interaction_history = " 2 previous tickets about 2FA setup" ,
82
- issue_description = " User is unable to reset their password after multiple attempts" ,
83
- custom_data = {" product_version" : " 2.1.0" , " subscription_tier" : " standard" },
84
- memory = memory,
97
+ customer_history_length = " long" if customer.interactions > 5 else " short" ,
98
+ sentiment = " frustrated" if sentiment_score < 0.3 else " neutral" ,
99
+ technical_level = customer.technical_proficiency
85
100
)
101
+ ```
86
102
87
- # Use the configuration with OpenAI
88
- response = client.chat.completions.create(** model_config)
103
+ ## 🚀 Getting Started
104
+
105
+ ### Installation
106
+
107
+ ``` bash
108
+ pip install promptix
89
109
```
90
110
91
- ## Builder Pattern
111
+ ### Quick Start
92
112
93
- Promptix provides a fluent builder pattern interface for creating model configurations:
113
+ 1 . ** Launch Promptix Studio** :
114
+ ``` bash
115
+ promptix studio
116
+ ```
117
+
118
+ 2 . ** Create your first prompt template** in the Studio UI or in your YAML file.
94
119
120
+ 3 . ** Use the prompt in your code** :
95
121
``` python
96
122
from promptix import Promptix
97
- import openai
98
123
99
- client = openai.OpenAI()
100
-
101
- # Using builder pattern for CustomerSupport
102
- model_config = (
103
- Promptix.builder(" CustomerSupport" )
104
- .with_user_name(" John Doe" )
105
- .with_issue_type(" account_settings" )
106
- .with_issue_description(" User cannot access account settings page" )
107
- .with_technical_level(" intermediate" )
108
- .with_priority(" medium" )
109
- .with_memory([
110
- {" role" : " user" , " content" : " I'm having trouble with my account settings" }
111
- ])
112
- .build()
124
+ # Basic usage
125
+ greeting = Promptix.get_prompt(
126
+ prompt_template = " Greeting" ,
127
+ user_name = " Alex"
113
128
)
114
129
115
- response = client.chat.completions.create(** model_config)
130
+ # With OpenAI
131
+ from openai import OpenAI
132
+ client = OpenAI()
116
133
117
- # Using builder pattern for Code Review
118
- code_config = (
119
- Promptix.builder(" CodeReview" )
120
- .with_code_snippet(code_snippet)
121
- .with_programming_language(" Python" )
122
- .with_review_focus(" Security and SQL Injection" )
123
- .with_severity(" high" )
124
- .build()
134
+ model_config = Promptix.prepare_model_config(
135
+ prompt_template = " CustomerSupport" ,
136
+ customer_name = " Jordan Smith" ,
137
+ issue = " billing question"
125
138
)
126
139
127
- # Anthropic Integration
128
- anthropic_config = (
129
- Promptix.builder(" CustomerSupport" )
130
- .with_version(" v5" )
131
- .with_user_name(" John Doe" )
132
- .with_issue_type(" account_settings" )
133
- .with_memory(memory)
134
- .for_client(" anthropic" )
135
- .build()
136
- )
140
+ response = client.chat.completions.create(** model_config)
137
141
```
138
142
139
- The builder pattern provides:
140
- - Type-safe configuration building
141
- - Fluent interface for better code readability
142
- - Automatic validation of required fields
143
- - Support for multiple LLM providers
144
- - Clear separation of configuration concerns
143
+ ## 📊 Real-World Use Cases
145
144
146
- ## Advanced Usage
145
+ ### Customer Service
146
+ Create dynamic support agent prompts that adapt based on:
147
+ - Department-specific knowledge and protocols
148
+ - Customer tier and history
149
+ - Issue type and severity
150
+ - Agent experience level
147
151
148
- ### Version Control
152
+ ### Phone Agents
153
+ Develop sophisticated call handling prompts that:
154
+ - Adjust tone and approach based on customer sentiment
155
+ - Incorporate relevant customer information
156
+ - Follow department-specific scripts and procedures
157
+ - Enable different tools based on the scenario
149
158
150
- ``` python
151
- # Get specific version of a prompt
152
- prompt_v1 = Promptix.get_prompt(
153
- prompt_template = " CustomerSupport" ,
154
- version = " v1" ,
155
- user_name = " John"
156
- )
159
+ ### Content Creation
160
+ Generate consistent but customizable content with prompts that:
161
+ - Adapt to different content formats and channels
162
+ - Maintain brand voice while allowing flexibility
163
+ - Include relevant reference materials based on topic
157
164
158
- # Get latest live version (default behavior)
159
- prompt_latest = Promptix.get_prompt(
160
- prompt_template = " CustomerSupport" ,
161
- user_name = " John"
165
+ ## 🧪 Advanced Usage
166
+
167
+ ### Custom Tools Configuration
168
+
169
+ ``` python
170
+ # Configure specialized tools for different scenarios
171
+ security_review_config = (
172
+ Promptix.builder(" CodeReviewer" )
173
+ .with_code_snippet(code)
174
+ .with_review_focus(" security" )
175
+ .with_tool(" vulnerability_scanner" )
176
+ .with_tool(" dependency_checker" )
177
+ .build()
162
178
)
163
179
```
164
180
@@ -167,73 +183,27 @@ prompt_latest = Promptix.get_prompt(
167
183
Promptix automatically validates your prompt variables against defined schemas:
168
184
169
185
``` python
170
- # Schema validation ensures correct variable types and values
171
186
try :
187
+ # Will raise error if technical_level isn't one of the allowed values
172
188
prompt = Promptix.get_prompt(
173
- prompt_template = " CustomerSupport" ,
174
- user_name = " John" ,
175
- technical_level = " expert" # Will raise error if not in ["beginner", "intermediate", "advanced"]
189
+ prompt_template = " TechnicalSupport" ,
190
+ technical_level = " expert" # Must be in ["beginner", "intermediate", "advanced"]
176
191
)
177
192
except ValueError as e:
178
193
print (f " Validation Error: { str (e)} " )
179
194
```
180
195
181
- ### Error Handling
182
-
183
- ``` python
184
- try :
185
- prompt = Promptix.get_prompt(
186
- prompt_template = " NonExistentTemplate" ,
187
- user_name = " John"
188
- )
189
- except ValueError as e:
190
- print (f " Error: { str (e)} " )
191
- ```
192
-
193
- ## Development
194
-
195
- ### Setup
196
-
197
- 1 . Clone the repository:
198
- ``` bash
199
- git clone https://github.com/promptix/promptix-python.git
200
- cd promptix-python
201
- ```
202
-
203
- 2 . Create a virtual environment:
204
- ``` bash
205
- python -m venv venv
206
- source venv/bin/activate # On Windows: venv\Scripts\activate
207
- ```
196
+ ## 🤝 Contributing
208
197
209
- 3 . Install development dependencies:
210
- ``` bash
211
- pip install -e " .[dev]"
212
- ```
213
-
214
- ### Running Tests
215
-
216
- ``` bash
217
- pytest
218
- ```
219
-
220
- ### Code Style
221
-
222
- We use ` black ` for code formatting and ` isort ` for import sorting:
223
-
224
- ``` bash
225
- black .
226
- isort .
227
- ```
198
+ Promptix is a new project aiming to solve real problems in prompt engineering. Your contributions and feedback are highly valued!
228
199
229
- ## Contributing
200
+ 1 . Star the repository to show support
201
+ 2 . Open issues for bugs or feature requests
202
+ 3 . Submit pull requests for improvements
203
+ 4 . Share your experience using Promptix
230
204
231
- 1 . Fork the repository
232
- 2 . Create your feature branch (` git checkout -b feature/amazing-feature ` )
233
- 3 . Commit your changes (` git commit -m 'Add some amazing feature' ` )
234
- 4 . Push to the branch (` git push origin feature/amazing-feature ` )
235
- 5 . Open a Pull Request
205
+ I'm creating these projects to solve problems I face as a developer, and I'd greatly appreciate your support and feedback!
236
206
237
- ## License
207
+ ## 📄 License
238
208
239
209
This project is licensed under the MIT License - see the [ LICENSE] ( LICENSE ) file for details.
0 commit comments