Class ScriptedProvider
- Namespace
- IntentSharp.Testing
- Assembly
- IntentSharp.dll
An in-process provider for tests. Returns canned replies in order, or computes a reply from the request. Records every request it receives so tests can check what was sent.
public sealed class ScriptedProvider : IAIProvider
- Inheritance
-
objectScriptedProvider
- Implements
- Inherited Members
-
object.Equals(object)object.Equals(object, object)object.GetHashCode()object.GetType()object.ReferenceEquals(object, object)object.ToString()
- Extension Methods
Constructors
- ScriptedProvider(Func<AIRequest, string>, Func<string, float[]>?)
Creates a provider that computes every reply from the request. Queued replies are ignored.
- ScriptedProvider(params string[])
Creates a provider that returns
repliesin order, one per call. It supports no embeddings.
Properties
- CallCount
The number of completion requests received.
- DefaultModel
The model name reported in every response. Default "scripted-1".
- Name
The provider name reported in results. Default "Scripted".
- Requests
Every request received, in order.
- SupportsEmbeddings
True when the provider was created with an embedder.
Methods
- CompleteAsync(AIRequest, CancellationToken)
Records the request and returns the responder's reply, or the next queued reply. Token usage is estimated at one token per four characters.
- EmbedAsync(string, CancellationToken)
Returns the embedder's vector for
text.
- Enqueue(string)
Adds a reply to the queue.