Class SpecialistIntentFile
- Namespace
- IntentSharp.Specialist
- Assembly
- IntentSharp.Specialist.dll
Helpers for a service adapter that exchanges intent files with its specialist service: the request's definition written as intent-file text, and an offer read from the intent-file text the service returns. Both go through the Catalog's IntentFile, so the text is the same as an intent file on disk and is checked the same way.
var text = SpecialistIntentFile.WriteRequest(request); // send this to the service
var offer = SpecialistIntentFile.ReadOffer(answer, "offer.intent.json"); // what the service sent back
public static class SpecialistIntentFile
- Inheritance
-
objectSpecialistIntentFile
- Inherited Members
-
object.Equals(object)object.Equals(object, object)object.GetHashCode()object.GetType()object.MemberwiseClone()object.ReferenceEquals(object, object)object.ToString()
Remarks
Facts about the specialist travel in the definition's extensions, under the name ExtensionName,
as an object with any of these keys: provider (the name of a provider configured on the client),
model, name (the specialist's name, kept exactly as given), id, revision, requestHash, maxInputTokens, maxOutputTokens,
requiredContext (a list of objects with kind, name, text, content and
reference) and properties (an object of texts). An extension is never sent to a model.
Example of what a service may return:
{
"name": "Support.TriageTicket",
"intent": "Classify the ticket.",
"shape": { "kind": "schema", "schema": { "type": "string" } },
"extensions": {
"specialist": { "provider": "TestSpecialist", "model": "triage-small", "name": "Triage Small", "id": "triage", "revision": "7", "maxInputTokens": 4000 }
}
}
Fields
- ExtensionName
The name of the definition extension that carries facts about the specialist:
specialist.
Methods
- ReadOffer(string, string, IAIProvider?)
Reads an offer from intent-file text that holds one definition: the definition becomes Definition, without the ExtensionName extension, which is read into Info, Model and, unless
provideris given, ProviderName.
- WriteOffer(SpecialistOffer)
Writes an offer as JSON intent-file text: its definition, with what the offer says about the specialist in
extensions.specialist(providerwhen it names a configured provider,model, and the facts of Info:name,id,revision,requestHash,maxInputTokens,maxOutputTokens,requiredContextandproperties), each only when set. ReadOffer(string, string, IAIProvider?) reads it back to the same offer; a provider the offer brought is not part of the text and is passed to ReadOffer(string, string, IAIProvider?) again. A SpecialistRuntime keeps a held specialist's definition this way (DefinitionText).
- WriteRequest(SpecialistRequest)
Writes the request's definition as JSON intent-file text, with the request hash in
extensions.specialist.requestHash, so a service that sends the definition back with that extension kept lets the definition comparison check that the offer answers this request. The context and the requirements are not part of the text; send them beside it in the form the service understands.