rephrasing package
rephrase
- async rephrasing.rephrase.condense_query_prompt(original_query, chat_history)[source]
Condense the prompt / query with the chat history & input message / query of the client.
Parameters
- original_query: str
original query from the client
- chat_history: str
previous chat history of the client
Returns
- condense_prompt: str
return a condensed prompt
- async rephrasing.rephrase.rephrase_query(original_query, chat_history=None)[source]
Rephrase the input message / query with chat history (if available) from openAI and return it.
Parameters
- original_query: str
original query from the client
- chat_history: str
previous chat history of the client (default: None)
Returns
- rephrased_response: dict
return a dictionary containing rephrased query token and other relevant metrics
Ex:
utils
from database.models import RephraseMetrics from database.db_operations import create_record