DSPy: The framework for programming—not prompting—language models
Python
Update FAQ about Multi-line Strings
Bill Chambersc7ef0b18f5d6
diff --git a/docs/docs/faqs.md b/docs/docs/faqs.mdindex 183958826..5826f4589 100644--- a/docs/docs/faqs.md+++ b/docs/docs/faqs.md@@ -32,6 +32,19 @@ You can specify multiple output fields. For the short-form signature, you can liYou can specify the generation of long responses as a `dspy.OutputField`. To ensure comprehensive checks of the content within the long-form generations, you can indicate the inclusion of citations per referenced context. Such constraints such as response length or citation inclusion can be stated through Signature descriptions, or concretely enforced through DSPy Assertions. Check out the [LongFormQA notebook](https://colab.research.google.com/github/stanfordnlp/dspy/blob/main/examples/longformqa/longformqa_assertions.ipynb) to learn more about **Generating long-form length responses to answer questions**.+- **How can I ensure that DSPy doesn't strip new line characters from my inputs?**++DSPy uses [Signatures](https://dspy-docs.vercel.app/docs/deep-dive/signature/understanding-signatures) to format prompts. In order to ensure that new line characters aren't stripped from longer inputs, you must specify `format=str` in the Field.++```python+class UnstrippedSignature(dspy.Signature):+ """Enter some information for the model here."""++ title = dspy.InputField()+ object = dspy.InputField(format=str)+ result = dspy.OutputField(format=str)+```+- **How do I define my own metrics? Can metrics return a float?**You can define metrics as simply Python functions that process model generations and evaluate them based on user-defined requirements. Metrics can compare existent data (e.g. gold labels) to model predictions or they can be used to assess various components of an output using validation feedback from LMs (e.g. LLMs-as-Judges). Metrics can return `bool`, `int`, and `float` types scores. Check out the official [Metrics docs](https://dspy-docs.vercel.app/docs/building-blocks/metrics) to learn more about defining custom metrics and advanced evaluations using AI feedback and/or DSPy programs.