Open beatobongco opened 2 months ago
I think you need a stop sequence, as it sounds like you're getting an insane amount of competition. I had this issue with working with Databricks model (DBRX), and had to add a stop_sequence to the model
dbrx = dsp.Databricks(model='databricks-dbrx-instruct',api_key='KEY',api_base="ENDPOINT",model_type='chat',stop=["\n"])
Hey @beatobongco! I recommend using TypedPredictors with Command R!
class RephraseSearchQueryWithHistory(dspy.Signature):
"""You are an assistant tasked with taking a natural language
query from a user and converting it into a query for a vectorstore.
In this process, you strip out information that is not relevant for
the retrieval task."""
chat_history: str = dspy.InputField(
desc="the chat history of the user and the assistant so far",
format=passages2text,
)
query: str = dspy.InputField(desc="the most recent user query")
rephrased_query: str = dspy.OutputField(desc="the rephrased query in English")
Then you implement with chat_history = dspy.TypedPredictor(RephraseSeachQueryWithHistory)
Code here if interested in digginging in further - https://github.com/stanfordnlp/dspy/blob/main/dspy/functional/functional.py
Here is a little more background from me also showing Assertions / Custom Guardrails approaches to this problem, but for this particular I think TypedPredictor
is the way to go - https://github.com/weaviate/recipes/blob/main/integrations/dspy/4.Structured-Outputs-with-DSPy.ipynb
Hey @beatobongco I changed the title of the issue to avoid confusion that the model itself is not working.
Thanks @CShorten will look into this :pray:
TLDR: There seems to be a problem extracting fields when using cohere's command-r
Given this example
I get this output
Checking
dspy.settings.lm.inspect_history(n=1)
I getI'd like to help with this issue -- just not tonight since I am braindead.
Any leads appreciated. cc @CShorten you might be interested since you worked on the command-r PR.