Rolebase Developers

AI and search

tRPC procedures of the ai and search routers: generate a role draft, summarize a meeting, get a scoped search key.

Two small routers back features the app cannot compute client-side: ai calls the language model, and search hands out a key scoped to one organization.

Query ai.generateRole

Generates a role draft from its name, for an authenticated user.

InputTypeDescription
nameStringRole name the draft is written from. Required.
langStringLanguage the draft is written in, as a language code. Required.

It returns a role_ai record with name, purpose, domain, accountabilities, checklist, indicators and notes, ready to copy into a role. Drafts are cached per name and language, so the same pair answers from storage instead of calling the model again.

const draft = await trpc.ai.generateRole.query({ name: 'Product Owner', lang: 'en' })

Query ai.generateMeetingSummary

Summarizes a meeting from its steps, notes and threads, for a Member of the organization.

InputTypeDescription
meetingIduuidMeeting to summarize. Required.
langStringLanguage the summary is written in, as a language code. Required.

It returns the summary as markdown. An unknown meeting answers NOT_FOUND.

Query search.getAlgoliaConfig

Returns the search credentials of an organization, for any member including Readonly.

InputTypeDescription
orgIduuidTarget organization. Required.

It returns { appId, apiKey, indexName }, where apiKey is a secured Algolia key filtered on that organization, so it cannot read another one. Reindexing the whole index is an internal procedure.