#What is the best alternative to command-r-plus since the model is deprecated?

7 messages · Page 1 of 1 (latest)

dense jay
#

What is the best alternative to command-r-plus since the model is deprecated?

I’ve tried command-a and command-r7b, but both give very descriptive answers.

What I want are short, direct answers.
For example:

If I ask: “What is your name?”

Current response: “My name is David.”

What I want: “David.”

I tried prompt tuning, but it isn’t working.

desert knoll
#

Hey there @dense jay ! Totally get your frustration with verbose answers. Here’s how to fix it:

  1. Use command-r7b or command-a but add this to your system prompt:
    "Respond with only the essential answer. No explanations. Example: If asked 'What is your name?', reply 'David' (not 'My name is David')."

  2. API Parameters:

    • Set max_tokens=20 to limit response length.
    • Use temperature=0.0 for focused outputs.
  3. Example Prompt:
    System: Answer directly with no filler.
    User: What’s the capital of France?
    Assistant: Paris.

Test this in Cohere’s playground first! If you need more help, I’m here. 🚀

dense jay
#

I'm still facing same issue
Is there a way to use command-r-plus
Or what is the fix for this

desert knoll
#

Since command-r-plus is deprecated, the best active alternative is ‘command-r-plus-08-2024’

Did you try system prompt btw? Here’s how to get concise answers:

  1. System Prompt:
    Use this exact instruction:
    "Respond with only the essential answer. No explanations. Example: If asked 'What is your name?', reply 'David' (not 'My name is David')."

  2. API Parameters:

    • max_tokens=20
    • temperature=0.0
  3. Example Workflow:

    System: Answer directly with no filler.
    User: What's the capital of France?
    Assistant: Paris.

If you’re still stuck, share your full prompt/parameters—I’ll help debug! 🚀

dense jay
#

def question_answering(request): try: prompt_template = """You are an extraction AI. Always return only the direct answer as plain text. Do not add any explanation, phrases, or formatting. Example: Q: What is your name? A: David Context: {context} """ # Prepare the prompt messages = [ SystemMessagePromptTemplate.from_template(prompt_template), HumanMessagePromptTemplate.from_template(request['question']) ] qa_prompt = ChatPromptTemplate.from_messages(messages) # Build the retriever retriever = build_retriever(request['file_id']) # Fetch relevant documents relevant_docs = retriever.get_relevant_documents(request['question']) # print(f"Relevant docs: {relevant_docs}") # Compress results for final retrieval using Cohere reranker compressor = CohereRerank(model="rerank-english-v3.0", top_n=8) compression_retriever = ContextualCompressionRetriever( base_compressor=compressor, base_retriever=retriever ) # Build the QA chain qa_chain = RetrievalQA.from_chain_type( llm=llm, chain_type="stuff", retriever=compression_retriever, return_source_documents=True, chain_type_kwargs={"prompt": qa_prompt} ) # Get the answer response = qa_chain.invoke({"query": request['question']}) if response.get('source_documents'): most_relevant_document = response['source_documents'][0].metadata.get('source', 'Unknown') result = { "statusCode": 200, "body": { # "reference": most_relevant_document, "answer": response['result'], "status": "success", "file_id": response['source_documents'][0].metadata.get('file_id', 'Unknown') } } else: result = { "statusCode": 200, "body": { "answer": "No relevant information found." } } return result except Exception as e: print("Error in question_answering:", e) return { "statusCode": 500, "body": { "message": "An error occurred while processing your request.", "error": str(e) } }

#

llm = ChatCohere(model=model_id, cohere_api_key=API_KEY, temperature=0.0,max_tokens=20)

dense jay
#

Any help?