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

feat: add commands in dict and function params #376

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion naas_drivers/tools/naas_chat_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ def check_tokens(self, prompt, model, limit=0.2):
return prompt_tokens, max_tokens

def create_plugin(
self, name, prompt, model="gpt-3.5-turbo-16k", temperature=0, output_path=None
self,
name,
prompt,
model="gpt-3.5-turbo-16k",
temperature=0,
output_path=None,
commands=[]
):
"""
Creates a JSON file for a chat plugin with specified parameters and saves it to the specified output path.
Expand All @@ -89,6 +95,7 @@ def create_plugin(
- model (str): The name of the model to be used for tokenization. Default is "gpt-3.5-turbo-16k".
- temperature (int): The temperature parameter for the model. Default is 0.
- output_path (str): The path where the JSON file should be saved. If not provided, it will be created from the plugin name.
- commandd (list): Webhook command to be executed to be executed to get insert data into your Naas Chat.

Returns:
str: The output path of the naas chat plugin.
Expand All @@ -106,6 +113,7 @@ def create_plugin(
"temperature": temperature,
"max_tokens": max_tokens,
"prompt": prompt,
"commands": commands,
}

# Save dict to JSON file
Expand Down
Loading