Parea python sdk
Project description
parea-sdk
Installation
pip install -U parea-ai
or install with Poetry
poetry add parea-ai
Getting Started
import os
from dotenv import load_dotenv
from parea import Parea
from parea.schemas.models import Completion, UseDeployedPrompt, CompletionResponse, UseDeployedPromptResponse
load_dotenv()
p = Parea(api_key=os.getenv("API_KEY"))
# You will find this deployment_id in the Parea dashboard
deployment_id = '<DEPLOYMENT_ID>'
# Assuming your deployed prompt's message is:
# {"role": "user", "content": "Write a hello world program using {{x}} and the {{y}} framework."}
inputs = {"inputs": {"x": "Golang", "y": "Fiber"}}
# You can easily unpack a dictionary into an attrs class
test_completion = Completion(
**{
"deployment_id": deployment_id,
"llm_inputs": inputs,
"metadata": {"purpose": "testing"}
}
)
# By passing in my inputs, in addition to the raw message with unfilled variables {{x}} and {{y}},
# you we will also get the filled-in prompt:
# {"role": "user", "content": "Write a hello world program using Golang and the Fiber framework."}
test_get_prompt = UseDeployedPrompt(deployment_id=deployment_id, inputs=inputs)
def main():
completion_response: CompletionResponse = p.completion(data=test_completion)
print(completion_response)
deployed_prompt: UseDeployedPromptResponse = p.get_prompt(data=test_get_prompt)
print("\n\n")
print(deployed_prompt)
async def main_async():
completion_response: CompletionResponse = await p.acompletion(data=test_completion)
print(completion_response)
deployed_prompt: UseDeployedPromptResponse = await p.aget_prompt(data=test_get_prompt)
print("\n\n")
print(deployed_prompt)
Open source community features
Ready-to-use Pull Requests templates and several Issue templates.
- Files such as:
LICENSE
,CONTRIBUTING.md
,CODE_OF_CONDUCT.md
, andSECURITY.md
are generated automatically. - Semantic Versions specification
with
Release Drafter
.
🛡 License
This project is licensed under the terms of the Apache Software License 2.0
license.
See LICENSE for more details.
📃 Citation
@misc{parea-sdk,
author = {joel-parea-ai},
title = {Parea python sdk},
year = {2023},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/parea-ai/parea-sdk}}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
parea_ai-0.1.1a3.tar.gz
(9.6 kB
view hashes)
Built Distribution
parea_ai-0.1.1a3-py3-none-any.whl
(10.2 kB
view hashes)
Close
Hashes for parea_ai-0.1.1a3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2806f92e43b360d16e9de7220c8e499cade3bbe3fe426fd72943469b4d130d47 |
|
MD5 | 587c68395b855740a4777ed5f5b4d13e |
|
BLAKE2b-256 | 244e6e63f5fb30d33e04c4f386aa7d0b44a492b26574a4509b1746565fe23fce |