Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenFunctions-v2: How to get prompt for multiturn conversation in inference_local.py? #260

Open
shellhue opened this issue Mar 14, 2024 · 1 comment
Labels
hosted-openfunctions-v2 Issues with OpenFunctions-v2

Comments

@shellhue
Copy link

In inference_local.py, get_prompt func just supports single query, so how to get prompt for multiturn conversation?

def get_prompt(user_query: str, functions: list = []) -> str:
    """
    Generates a conversation prompt based on the user's query and a list of functions.

    Parameters:
    - user_query (str): The user's query.
    - functions (list): A list of functions to include in the prompt.

    Returns:
    - str: The formatted conversation prompt.
    """
    system = "You are an AI programming assistant, utilizing the Gorilla LLM model, developed by Gorilla LLM, and you only answer questions related to computer science. For politically sensitive questions, security and privacy issues, and other non-computer science questions, you will refuse to answer."
    if len(functions) == 0:
        return f"{system}\n### Instruction: <<question>> {user_query}\n### Response: "
    functions_string = json.dumps(functions)
    return f"{system}\n### Instruction: <<function>>{functions_string}\n<<question>>{user_query}\n### Response: "

@shellhue shellhue added the hosted-openfunctions-v2 Issues with OpenFunctions-v2 label Mar 14, 2024
@Watebear
Copy link

Watebear commented Apr 8, 2024

I try to concat multi-turns as follow:
"Instruction: <> Response: Instruction: <> Response: ",
but model reject to give an answer.

The outputs is ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hosted-openfunctions-v2 Issues with OpenFunctions-v2
Projects
None yet
Development

No branches or pull requests

2 participants