promptrix-py
Promptrix is a prompt layout engine for Large Language Models.
Here is a first trivial example:
from promptrix import promptrixTypes, VolatileMemory, FunctionRegistry, GPT3Tokenizer
from promptrix.Prompt import Prompt
from promptrix.SystemMessage import SystemMessage
from promptrix.UserMessage import UserMessage
from promptrix.AssistantMessage import AssistantMessage
from promptrix.ConversationHistory import ConversationHistory
functions = FunctionRegistry()
tokenizer = GPT3Tokenizer()
memory = VolatileMemory({'input':'', 'history':[]})
max_tokens = 2000
prompt_text = 'You are helpful, creative, clever, and very friendly. '
PROMPT = Prompt([
UserMessage(prompt_text),
ConversationHistory('history', .5), # allow history to use up 1/2 the remaining token budget left after the prompt and input
UserMessage('{{$input}}')
])
async def render_messages_completion():
as_msgs = await PROMPT.renderAsMessages(memory, functions, tokenizer, max_tokens)
msgs = []
if not as_msgs.tooLong:
msgs = as_msgs.output
return msgs
### basic chat loop
while True:
memory.set('input', query)
msgs = asyncio.run(render_messages_completion())
response = ... your favorite llm api (model, msgs, ...)
print(response)
history = memory.get('history')
history.append({'role':USER_PREFIX, 'content': query})
history.append({'role': ASSISTANT_PREFIX, 'content': response})
memory.set('history', history)
Metadata
Release files for promptrix 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| promptrix-0.3.1.tar.gz | 9.3 kB | Without provenance | Details for promptrix-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| promptrix-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for promptrix-0.3.1-py3-none-any.whl |
Total release size: 22.4 kB
Release files / promptrix-0.3.1.tar.gz
| Download URL | promptrix-0.3.1.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e515b5e10e17c2d11bb5f9a2775107214428f7ca827e2fc9b085228a5edaf6cf
|
|
BLAKE2b-256 checksum How to use checksums |
21759c7f9637eb6a8054a2f6c46f68fb4c087db59f895a1ce03036cc98d4d23f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / promptrix-0.3.1-py3-none-any.whl
| Download URL | promptrix-0.3.1-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
013b1502570140f3f300336537947881c7625357fceb9a025c6effea4ed43b82
|
|
BLAKE2b-256 checksum How to use checksums |
2137f5544e026d288e6c14917eafc7dcbce08a0a88ef776d61e1133002ca839e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for promptrix 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.