toucans
1.0.0
لا توجد هندسة هراء موجهة باستخدام Jinja2 لالتقاط الفطريات الديناميكية و litellm لاستخدام مجموعة واسعة من مزودي LLM بسلاسة.
pip install toucans
تهيئة repportfunction:
from toucans import PromptFunction
sentiment = PromptFunction (
model = "gpt-4" ,
temperature = 0.7 ,
messages = [
{ "role" : "system" , "content" : "You are a helpful mood-sensitive agent." },
{ "role" : "user" , "content" : "Determine the sentiment of the sentence: {{ sentence }}" },
],
)
توليد إكمال عن طريق الاتصال بالوظيفة المذهلة مع جملة:
completion = sentiment ( sentence = "I'm so happy!" )
batch_args = [
{ "sentence" : "Toucans is nice Python package!" },
{ "sentence" : "I hate bloated prompt engineering frameworks!" }
]
completion_batch = sentiment . batch_call ( batch_args = batch_args )
احفظ/قم بتحميل الوظيفي الموجه إلى الدليل:
# Push to dir (not implemented yet)
sentiment . push_to_dir ( "./sentiment/" )
# Load from dir (not implemented yet)
sentiment = PromptFunction . from_dir ( "./sentiment/" )
ادفع/اسحب الوظيفي من محور Toucans:
# Push to hub
sentiment . push_to_hub ( "juunge/sentiment" )
# Load from hub
sentiment = PromptFunction . from_hub ( "juunge/sentiment" )
في الوقت الحالي ، يتطلب التحميل من مركز Toucans استضافة مثيل منه بنفسك وتعيين متغير بيئة Hub_API_URL.