Prompt Templates
Hopfield always uses string literal types for prompt templates, so developers have visibility into the tranformations performed on their inputs.
Usage
Check out how our types look when you use a template:
ts
importhop from "hopfield";importopenai from "hopfield/openai";consttemplate =hop .client (openai ).template ();constdescription =template .enum ("The category of the message.");
ts
importhop from "hopfield";importopenai from "hopfield/openai";consttemplate =hop .client (openai ).template ();constdescription =template .enum ("The category of the message.");
You can see above that the description has type hints to tell you exactly what the transformation was. In this case, the template appended This must always be a possible value from the enum array.
to the input string.
This template is usually used with complex function calls. See the next section for more information.
Composability
We will be building on top of the Prompt Templating primitive with features which have more complex transformations. Specifically, we will be shipping best practices for few-shot prompting and RAG, so chat messages
are strongly typed and adhere to emerging industry standards.
INFO
We are actively working on building this feature further - please reach out if you are interested in influencing this!