Bookmark API
api_delete_all_bookmark()
api_delete_bookmark(bookmark_name)
Removes a bookmark from the database using its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bookmark_name |
str
|
The name of the bookmark to be removed. |
required |
Source code in moonshot/src/api/api_bookmark.py
api_export_bookmarks(export_file_name='bookmarks')
Exports bookmarks to a specified file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
export_file_name |
str
|
The name of the file to export the bookmarks to. |
'bookmarks'
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The filepath of where the file is written. |
Source code in moonshot/src/api/api_bookmark.py
api_get_all_bookmarks()
Retrieves a list of all bookmarks from the database.
Returns:
Type | Description |
---|---|
list[dict]
|
list[dict]: A list of bookmarks, each represented as a dictionary. |
api_get_bookmark(bookmark_name)
Retrieves the details of a specific bookmark by its name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bookmark_name |
int
|
The name of the bookmark to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
The bookmark details corresponding to the provided ID. |
Source code in moonshot/src/api/api_bookmark.py
api_insert_bookmark(name, prompt, prepared_prompt, response, context_strategy='', prompt_template='', attack_module='', metric='')
Inserts a new bookmark into the database.
This function constructs a BookmarkArguments object with the provided details and invokes the add_bookmark method of a Bookmark instance to persist the new bookmark.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The unique name of the bookmark. |
required |
prompt |
str
|
The associated prompt text for the bookmark. |
required |
response |
str
|
The corresponding response text for the bookmark. |
required |
context_strategy |
str
|
The strategy used for context management in the bookmark. |
''
|
prompt_template |
str
|
The template used for generating the prompt. |
''
|
attack_module |
str
|
The attack module linked with the bookmark. |
''
|