toucans
1.0.0
ไม่มีวิศวกรรมการพล่ามโดยใช้ Jinja2 สำหรับการกระตุ้นด้วยแรงกระตุ้นแบบไดนามิกและ litellm เพื่อใช้ผู้ให้บริการ LLM ที่หลากหลายอย่างราบรื่น
pip install toucans
เริ่มต้นการแจ้งความผิดพลาด:
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 )
บันทึก/โหลด promptfunction ไปยังไดเรกทอรี:
# 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