-
Notifications
You must be signed in to change notification settings - Fork 7
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
[scripting] expose universalCompletion class in __init__.py #39
Comments
I think it is also worth creating a universalQuery class that can be used to create a query that (1) validates a passed model_name and, based on this, properly generates a query based on a question passed to a corresponding method, and then queries using a separate method. class universalQuery:
def __init__(self, model_name):
...
def generate_query(self, question, tag):
# I think it's best for us to expect users to pull out the tag outside the context of this class method
...
def submit_query_sync(self, query): # synchronous query
...
def submit_query_async(self, query): # asynchronous query
... We can expose this in init.py, even though it is not really how we do things. |
[scripting] extend the UniversalCompletion class with context generation def build_context(self,
prompt: str,
context: List[Dict[str, str]],
max_context_length: int,
model_type: Optional[str] = None,
context_keywords_only: bool = True,
additional_context: str = "",
) -> Union[str, List[Dict[str, str]]]:
"""
Builds a full query context for a given prompt and context.
Parameters:
prompt (str): The main prompt to build the context around.
context (List[Dict[str, str]]): List of past prompts and responses.
max_context_length (int): Maximum length of the context to return.
model_type (Optional[str]): Type of the language model. If 'v1/chat/completions', return a list of dicts
with 'role' and 'content' keys. If not, return a string. Default is None.
context_keywords_only (bool, optional): If True, use only the most common phrases and words from the context
and additional context. Default is True.
additional_context (str, optional): Additional context to add to the context. Default is an empty string.
Returns:
Union[str, List[Dict[str, str]]]: If `model_type` is 'v1/chat/completions', returns a list of dicts with
'role' and 'content' keys. If not, returns a string.
"""
pass |
The text was updated successfully, but these errors were encountered: