-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Chat with LLM (PT-188527956) #17
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.
This looks great. I did raise some questions/concerns.
Some of them you might want to defer to other PRs.
src/models/assistant-model.ts
Outdated
while (runState.status !== "completed" && runState.status !== "requires_action") { | ||
runState = yield davai.beta.threads.runs.retrieve(self.thread.id, run.id); | ||
} |
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.
This loop worries me. If the state is something like "canceled" or "failed", wouldn't it loop forever? And if it just takes a while to complete, is it going to be calling the API every millisecond to check on 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.
Good point. This will be addressed in separate branch.
src/models/assistant-model.ts
Outdated
const response = yield fetch(`${process.env.REACT_APP_OPENAI_BASE_URL}threads/${threadId}`, { | ||
method: "DELETE", | ||
headers: { | ||
Authorization: `Bearer ${process.env.REACT_APP_OPENAI_API_KEY}`, | ||
"OpenAI-Beta": "assistants=v2", | ||
"Content-Type": "application/json", | ||
}, | ||
}); |
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.
This feels like it should be in a utility class. Surprising that the library doesn't give you a method for it and you have to construct the http headers yourself.
#188527956
These changes allow the plugin to connect with an LLM for basic chat functionality via the OpenAI API. In addition, they:
get_attributes
andcreate_graph
. These are basic proof-of-concept functions for interaction with CODAP. More will be added by work on a separate story.