|
<< Click to Display Table of Contents >> Navigation: »No topics above this level« AIN. - AnythingLLM AI |
MiniRobotLanguage (MRL)
AIN.GetWordCount
Get the Word Count from the Last Response
Intention
GetWordCount Command: Count Words in Last Response
The GetWordCount Command retrieves the word count of the most recent response from the AnythingLLM API, useful for analysis or tracking usage.
This helps monitor response length without manual counting.
It�s part of the AIN - AnythingLLM AI suite.
This Command calculates and returns the number of words in the last API response, typically from a chat or thread operation.
It requires no input parameters beyond an optional variable to store the result, which is also placed on the stack.
Word counting is useful for:
�Usage Tracking: Monitor response verbosity.
�Analysis: Assess response complexity or length.
�Automation: Trigger actions based on word count.
Call this Command after an API response to get the word count, optionally storing it in a variable.
The count is also pushed to the stack for immediate use.
Example Usage
AIN.ExecuteThreadChat|my-workspace|thread-001|What is the weather like?|$$RES
DBP.Response: $$RES
AIN.GetWordCount|$$CNT
DBP.Word Count: $$CNT
This counts words in the response to "What is the weather like?".
Illustration
+---------------+
� Word Count � ��
+---------------�
� 10 words � � ��
+---------------+
The number of words in the last response.
Syntax
AIN.GetWordCount[|P1]
Parameter Explanation
P1 - (Optional) Variable to store the word count; otherwise, it�s on the stack.
Example
AIN.ExecuteThreadChat|my-workspace|thread-001|Tell me a story|$$RES
DBP.Story: $$RES
AIN.GetWordCount|$$CNT
DBP.Words: $$CNT
ENR.
Remarks
- Requires a prior API response to count words from.
- Word count definition may vary (e.g., spaces, punctuation).
Limitations
- Fails if no prior response exists.
- Limited to 1-2 parameters based on typical AIN Command structure.
See also: