TextDataSource class
A data source that can be used to add a static block of text to a prompt.
Remarks
Primarily used for testing but could be used to inject some externally define text into a
prompt. The text will be truncated to fit within the maxTokens
limit.
Constructors
Text |
Creates a new |
Properties
name |
Methods
render |
Renders the data source as a string of text. |
Constructor Details
TextDataSource(string, string)
Creates a new TextDataSource
instance.
new TextDataSource(name: string, text: string)
Parameters
- name
-
string
Name of the data source.
- text
-
string
Text to inject into the prompt.
Property Details
name
string name
Property Value
string
Name of the data source.
Method Details
renderData(TurnContext, Memory, Tokenizer, number)
Renders the data source as a string of text.
function renderData(context: TurnContext, memory: Memory, tokenizer: Tokenizer, maxTokens: number): Promise<RenderedPromptSection<string>>
Parameters
- context
-
TurnContext
Turn context for the current turn of conversation with the user.
- memory
- Memory
An interface for accessing state values.
- tokenizer
- Tokenizer
Tokenizer to use when rendering the data source.
- maxTokens
-
number
Maximum number of tokens allowed to be rendered.
Returns
Promise<RenderedPromptSection<string>>
The text to inject into the prompt as a RenderedPromptSection
object.