-
Notifications
You must be signed in to change notification settings - Fork 5
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI failure is just because v10.2.0 of @grafana/runtime
requires Node >= 18. I'd suggest just downgrading back to v10.0.0 and commenting the logError
line for now though, until we decide to upgrade all the @grafana
packages to v10.2. Otherwise I think this should work!
Co-authored-by: Ben Sully <[email protected]>
Co-authored-by: Ben Sully <[email protected]>
Thanks for your help @sd2k, I think this is ready to merge in. It will need to be tested as an import after next experimental release. |
Could you revert the changes to |
This is done and it should be fine now |
/** | ||
* A custom React hook for managing an OpenAI stream that communicates with the provided model. | ||
* | ||
* @param {string} [model=DEFAULT_OAI_MODEL] - The OpenAI model to use for communication. | ||
* @param {number} [temperature=1] - The temperature value for text generation (default is 1). | ||
* @param {function} [notifyError] - A callback function for handling errors. | ||
* | ||
* @returns {OpenAIStreamState} - An object containing the state of the OpenAI stream. | ||
* @property {function} setMessages - A function to update the list of messages in the stream. | ||
* @property {string} reply - The most recent reply received from the OpenAI stream. | ||
* @property {StreamStatus} streamStatus - The status of the stream ("idle", "generating" or "completed"). | ||
* @property {Error|undefined} error - An error object if an error occurs, or undefined if no error. | ||
* @property {object|undefined} value - The current value of the stream. | ||
* @property {boolean|undefined} value.enabled - Indicates whether the stream is enabled (true or false). | ||
* @property {Subscription|undefined} value.stream - The stream subscription object if the stream is active, or undefined if not. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how easy this will be but could you add a super minimal example to the JSDoc? It can be similar to the examples in the other exposed functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is feasible because there is so much handling to do, but once we have a working example elsewhere perhaps we can link it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really clean code and a pleasure to review. LGTM!
This was missing from #94 and causes local builds to break.
Add react hook to openai module
This was missing from #94 and causes local builds to break.
This won't build, I think because of the react version, leaving it in a draft PR in case anyone else wants to repro or work on it.