dspy
dspy copied to clipboard
DSPy: The framework for programming—not prompting—language models
In my current setup, I write everything in DSPy, then I extract the prompt form the dspy module. Then, I use that prompt with litellm to stream the output to...
``` import dspy from typing import List, Literal # Agent setup # A signature class ItemDetectionSig(dspy.Signature): '''Given a list of product names, evaluate each item to determine whether it represents...
``` ,-~~-.___. / | ' \ ( ) 0 \_/-, ,----' ==== // / \-'~; /~~~(O) / __/~| / | =( _____| (_________| ``` ```python from dspy.evaluate import tracer @tracer...
Suppose I have the following program ``` def custom_evaluate(dataset, metric, model, debug=False): acc = 0 cont = 1 for item in dataset: pred = model( sentence1=item.sentence1, sentence2=item.sentence2, target_word=item.target_word, ) if...
The way python assert statements are used here is potentially not correct. These should be raising exceptions instead See these for example, I have not done an exhaustive search https://github.com/stanfordnlp/dspy/blob/main/dsp/templates/template_v2.py#L102...
Hi, There seem to be some big changes and I cannot find a single example that tells me how to load huggingface models that I was using with `HF.model` before....
The DataLoader class in the dspy framework simplifies the process of loading and processing datasets from various sources such as Hugging Face, CSV, JSON, Parquet files, and Pandas DataFrames. It...
Similar to `dspy.Assert`/`dspy.Suggest`, but this is constraint tied to modules. It's less powerful, but sufficient for most existing use cases, and the usage is more lightweighted.
Hi there, I was wondering it was possible to allow [output scores/probabilities](https://huggingface.co/docs/transformers/internal/generation_utils) in completions? This is to be able to see probability scores for each token. Best, Zoher
Retries via LiteLLM RetryPolicy This depends on https://github.com/BerriAI/litellm/pull/6916 being merged and released (may take some coordination)