Helpdesk Knowledge Base Entry

Added in version 3.3.0.

Requires Redmine >= 5.0 and the redmine_expert_helpdesk plugin >= 0.23.0. Reading requires the view_helpdesk_kb permission, creating, updating, approving and rejecting edit_helpdesk_kb, deleting, reindexing and re-extracting manage_helpdesk_kb.

The plugin keeps the entry in its database and a copy of the approved ones in a vector store. Every write re-embeds an approved entry and removes any other one from the vector store, the entry returned by a write carries the outcome in vector_sync:

  • indexed - approved and embedded, searchable with the new text

  • removed - not approved and not in the vector store

  • not_configured - approved, but the knowledge base is switched off or not configured

  • problem_blank - approved, but there is no problem text to embed

  • index_failed - approved, but embedding failed, retry or reindex

  • unindex_failed - not approved, but removing it from the vector store failed

Manager

All operations on the HelpdeskKbEntry resource are provided by its manager. To get access to it you have to call redmine.helpdesk_kb_entry where redmine is a configured redmine object. See the Configuration about how to configure redmine object.

Create methods

create

redminelib.managers.ResourceManager.create(**fields)

Creates new HelpdeskKbEntry resource with given fields. Entries created through the API count as curated, so closing the ticket again does not overwrite them with a new extraction.

Parameters:
  • project_id (int or string) – (required). Id or identifier of entry’s project.

  • issue_id (int) – (required). Id of a ticket of the project, one entry per ticket.

  • problem (string) – (optional). Problem description, this is the text that is embedded.

  • solution (string) – (optional). Solution.

  • status (string) – (optional). One of approved or pending (default).

Returns:

Resource object

>>> entry = redmine.helpdesk_kb_entry.create(
...     project_id='support',
...     issue_id=4711,
...     problem='VPN connection drops after 10 minutes',
...     solution='Lowered the MTU on the client to 1400',
...     status='approved'
... )
>>> entry
<redminelib.resources.HelpdeskKbEntry #17 "approved">
>>> entry.vector_sync
'indexed'

Read methods

get

redminelib.managers.ResourceManager.get(resource_id)

Returns single HelpdeskKbEntry resource by its id.

Parameters:

resource_id (int) – (required). Id of the entry.

Returns:

Resource object

>>> entry = redmine.helpdesk_kb_entry.get(17)
>>> entry.issue
<redminelib.resources.Issue #4711 "Printer offline">
>>> entry.indexed
True

Hint

The issue contains the ticket’s subject only if the user may see the ticket.

all

Not supported by the Helpdesk plugin

filter

redminelib.managers.ResourceManager.filter(**filters)

Returns HelpdeskKbEntry resources of a project, most recently changed first.

Parameters:
  • project_id (int or string) – (required). Id or identifier of entries’ project.

  • status (string) – (optional). One of pending, approved, skipped, rejected (comma-separated for several) or all. Entries with status skipped are hidden by default.

  • q (string) – (optional). Case-insensitive text search in problem and solution.

  • issue_id (string) – (optional). Only entries of these tickets, comma-separated.

  • limit (int) – (optional). How much resources to return.

  • offset (int) – (optional). Starting from what resource to return the other resources.

Returns:

ResourceSet object

>>> entries = redmine.helpdesk_kb_entry.filter(project_id='support', status='pending', q='printer')

Update methods

update

redminelib.managers.ResourceManager.update(resource_id, **fields)

Updates values of given fields of a HelpdeskKbEntry resource. Unlike most resources the plugin answers with the updated entry, which is returned.

Parameters:
  • resource_id (int) – (required). Entry id.

  • problem (string) – (optional). Problem description.

  • solution (string) – (optional). Solution.

  • status (string) – (optional). One of approved or pending, use reject() to reject.

Returns:

Resource object

>>> entry = redmine.helpdesk_kb_entry.update(17, solution='Installed driver 4.2')
>>> entry.vector_sync
'indexed'

save

redminelib.resources.HelpdeskKbEntry.save(**attrs)

Saves current state of a HelpdeskKbEntry resource, an update takes over the entry the plugin returns, including vector_sync.

Returns:

Resource object

>>> entry = redmine.helpdesk_kb_entry.get(17)
>>> entry.save(problem='Network printer prints nothing')
<redminelib.resources.HelpdeskKbEntry #17 "approved">
>>> entry.vector_sync
'indexed'

Delete methods

delete

redminelib.managers.ResourceManager.delete(resource_id)

Deletes single HelpdeskKbEntry resource by its id. If the entry can’t be removed from the vector store it is kept and a ValidationError is raised.

Parameters:

resource_id (int) – (required). Entry id.

Returns:

True

Other methods

approve / reject

redminelib.managers.HelpdeskKbEntryManager.approve(entry_id)

Approves an entry, which embeds it into the vector store.

Parameters:

entry_id (int) – (required). Entry id.

Returns:

Resource object

redminelib.managers.HelpdeskKbEntryManager.reject(entry_id)

Rejects an entry, which removes it from the vector store. A rejected entry is kept, so closing its ticket again does not bring it back.

Parameters:

entry_id (int) – (required). Entry id.

Returns:

Resource object

Both are also available on the resource, which then takes over the returned entry. Unsaved changes of the resource are discarded, as the curation supersedes them:

>>> redmine.helpdesk_kb_entry.approve(17).vector_sync
'indexed'
>>> entry = redmine.helpdesk_kb_entry.get(17)
>>> entry.reject().status
'rejected'

reindex

redminelib.managers.HelpdeskKbEntryManager.reindex(project_id)

Queues the rebuild of a project’s vector index, which re-embeds every approved entry in the background. Raises ValidationError if the knowledge base is not configured.

Parameters:

project_id (int or string) – (required). Id or identifier of the project.

Returns:

dict with action, queued and count (number of approved entries)

>>> redmine.helpdesk_kb_entry.reindex('support')
{'action': 'reindex', 'queued': True, 'count': 42}

reextract

redminelib.managers.HelpdeskKbEntryManager.reextract(project_id, all=False)

Queues the AI re-extraction of the entries that are not at the project’s current detail level, with all=True of every eligible entry. Curated and rejected entries are never re-extracted. Each entry costs one AI call. Raises ValidationError if the knowledge base is not configured.

Parameters:
  • project_id (int or string) – (required). Id or identifier of the project.

  • all (bool) – (optional). Re-extract every eligible entry.

Returns:

dict with action, queued and count, queued is False if there was nothing to re-extract

>>> redmine.helpdesk_kb_entry.reextract('support', all=True)
{'action': 'reextract', 'queued': True, 'count': 7}

Export

Not supported by the Helpdesk plugin