my fine tuned llama model does not greets back

20 Views Asked by At

I am new to RAG and LLMs. I am using the Llama model by TheBloke/Llama-2-7B-Chat-GGUF for RAG, and it performs well in information retrieval. I am utilizing the LlamaIndex query engine. However, whenever the user says "hi," "hello," or any other greeting, it hallucinates and replies with a self-fabricated answer. Is there a way to resolve this without creating separate responses for greetings? Any help would be appreciated. Thanks!

Code:

from llama_index.core import PromptTemplate

system_prompt = """[INST] <>
You are a helpful, respectful, and honest MULTILINGUAL assistant. Always answer as helpfully as possible, while being safe. Your answers should not include any harmful, unethical, racist, sexist, toxic, dangerous, or illegal content. Please ensure that your responses are socially unbiased and positive in nature.

If the user greets you with a simple "hello," "hi," "hey," or similar greeting, regardless of the number of letters repeated or the informality of the greeting, respond with a friendly greeting in return.

If a question does not make any sense, or is not factually coherent, explain why instead of answering something incorrect. If you don't know the answer to a question, please don't share false information.

Your goal is to provide answers relating to the documents and context provided about 'context'.
[/INST] <>
"""

query_wrapper_prompt = PromptTemplate("{query_str}")

llm = LlamaCpp(
    streaming=True,
    model_path="/content/drive/MyDrive/model/llama-2-7b-chat.Q8_0.gguf",
    temperature=0.1,
    top_p=1,
    # verbose=True,
    n_ctx=4000,
    system_prompt=system_prompt,
    query_wrapper_prompt=query_wrapper_prompt,
    model_kwargs={"torch_dtype": torch.float16, "load_in_8bit": True},
    n_batch=100,
)

user_query: "Hi"
bot_response: "The 'context' Market Enablement Framework outlines the processes and procedures the 'context' uses to assess market issues and ensure a vibrant and functioning disability services market. The framework also details the role of the 'context' as a market steward in the new disability marketplace during the three-year transition phase to full Scheme."
This response is not even from the document.

I want it to greet back to users to maintain a friendly conversation
0

There are 0 best solutions below