llmasaservice-client 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/useLLM.ts +2 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/useLLM.ts
CHANGED
|
@@ -46,6 +46,7 @@ export const useLLM = (options?: LLMServiceType): UseLLMReturnType => {
|
|
|
46
46
|
* @param stream Determines whether to stream results back in the response property as they return from the service or batch them up and return them all at once in the response property as a string.
|
|
47
47
|
* @param abortController The AbortController used to abort this request once its started. This allows you to add a stop button to your UI.
|
|
48
48
|
* @param service The service to use for the request. If null, load balancing will be applied. This is typically only used for testing.
|
|
49
|
+
* @param onCompleteCallback The callback function to be called once the stream completes, with the final result string.
|
|
49
50
|
* @returns a StreamReader object if stream is true, otherwise a string of the response. Typically this isn't used when streaming, the stream is exposed in the response property.
|
|
50
51
|
*/
|
|
51
52
|
async function send(
|
|
@@ -54,7 +55,7 @@ export const useLLM = (options?: LLMServiceType): UseLLMReturnType => {
|
|
|
54
55
|
stream: boolean = true,
|
|
55
56
|
abortController: AbortController = new AbortController(),
|
|
56
57
|
service: string | null = null, // null means use the default service and apply services load balancing
|
|
57
|
-
onCompleteCallback?:
|
|
58
|
+
onCompleteCallback?: (result: string) => void
|
|
58
59
|
): Promise<ReadableStreamDefaultReader<any> | string | undefined> {
|
|
59
60
|
setResponse("");
|
|
60
61
|
setIdle(false);
|