34 AI services
db.Services gives your code four AI services. Each goes through a provider configured for the
database, so your code uses the installation's account and needs no vendor keys of its own.
| Service | Reached through | What it does | Settings |
|---|---|---|---|
| Text | db.Services.AI |
Embeddings and completions. Semantic search (§21) uses the embeddings by itself | AISettings (§12.1) |
| Images | db.Services.Imaging |
Creates and changes images, describes them and answers questions about them | ImagingSettings |
| Files to text | db.Services.FileToText |
The text of documents, PDFs, e-mails and pictures (by OCR), and transcripts of recordings | FileToTextSettings |
| Translation | db.Services.Translation |
Translates texts and detects their language | TranslationSettings |
On a server, images, files to text and translation work without any settings. They call the hosted
Relatude services and charge each call to the installation's license, which needs an API key
(§35.4). Text needs AISettings, either for the hosted service
or for your own OpenAI, Azure OpenAI or Anthropic account
(§34.1). Each service is an interface, so you can swap the
hosted service for a provider of your own (§35.2) without changing
the code that calls it.
ImagingSettings, FileToTextSettings and TranslationSettings share four keys. On a server you
usually set none of them:
| Key | What it does |
|---|---|
TypeName |
Empty or RelatudeServices for the hosted service, otherwise your own provider's type |
ServiceUrl |
Set it only for a self-hosted service |
ApiKey |
Only where there is no license key: a store built from code, or your own provider |
CacheType |
Where answers are kept on the server: Native (the default), Memory or None (§34.5) |
db.Services.HasAI, HasImaging, HasFileToText, HasTranslation, HasIPLookup and HasSMS tell
you whether a service is there; db.Services.AI and the others throw when it is not. A store built
from code, without a server, is given its providers in the NodeStore constructor:
new NodeStore(datastore, imaging: new RelatudeServicesImagingProvider(settings)).
- 34.1 Text: embeddings and completions — To use the hosted Relatude AI service, set AISettings for the database (§12.1 lists every key and provider):
- 34.2 Images — Images go in as bytes (PNG, JPEG or WebP) and come back as PNG:
- 34.3 Files to text — The file type is found from the content, not the name. The languages, most likely first, help OCR. You can pass a stream instead of bytes. In the FileToTextResult, Text has lines ending in \n and pages separated by a…
- 34.4 Translation — Languages are BCP 47 codes such as en, nb, zh-Hans and pt-PT. Answers use the codes GetLanguagesAsync() lists, so nb-NO and no come back as nb. A language the service does not translate is refused with a 400 before…
- 34.5 Prices, answers kept, and errors — This applies to every hosted Relatude service. Each call is charged to the license's credit account for the service, and every answer carries Credits (what the call cost) and CreditsLeft (what is left)…