toucans
1.0.0
No hay ingeniería rápida de mierda usando Jinja2 para una plantilla de inmediato dinámica y litellm para usar sin problemas una amplia gama de proveedores de LLM.
pip install toucans
Inicializar una función previa:
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 }}" },
],
)
Genere una finalización llamando a la función previa con una oración:
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 )
Guardar/Cargar la función prevista a un directorio:
# Push to dir (not implemented yet)
sentiment . push_to_dir ( "./sentiment/" )
# Load from dir (not implemented yet)
sentiment = PromptFunction . from_dir ( "./sentiment/" )
Push/tire de la función de anticipación desde el centro de Tucans:
# Push to hub
sentiment . push_to_hub ( "juunge/sentiment" )
# Load from hub
sentiment = PromptFunction . from_hub ( "juunge/sentiment" )
Por ahora, cargar desde el centro de Tucans requiere alojar una instancia usted mismo y establecer la variable de entorno HUB_API_URL.