Format your own prompts
This is mostly to add onto Hamels great post called Fuck you show me the prompt
I think too many llm libraries are trying to format your strings in weird ways that don't make sense. In an OpenAI call for the most part what they accept is an array of messages.
from pydantic import BaseModel
class Messages(BaseModel):
content: str
role: Literal["user", "system", "assistant"]
But so many libaries wanted me you to submit a string block and offer some synatic sugar to make it look like this: They also tend to map the docstring to the prompt. so instead of accessing a string variable I have to access the docstring via __doc__.