-
Notifications
You must be signed in to change notification settings - Fork 364
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: Assistants API Beta Implemented #140
base: main
Are you sure you want to change the base?
Conversation
* feat: Assistants API * Rem accidentally committed Dev team * Demoapp syntax fix for ImageCreationView * assistant paging, modify, fix * demo: enhancement: Handle local message replacement, README update * clean, runRetrieveSteps implemented, SupportedFileTypes implemented * Handle run retrieve steps * Assistant README, add run retrieve steps * display run retrieve steps in updating fashion for code_interpreter
Quality Gate passedThe SonarCloud Quality Gate passed, but some issues were introduced. 55 New issues |
Looking forward for this PR to be merged. 👁️ |
Just what I need! |
… thread in a single request; submit tool outputs.
thanks @cdillard for doing this. Please review it and get it merged guys |
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.
Hey @cdillard! 👋
You did an amazing job! ❤️🔥
Thank you for your time and contribution to the project. This is a splendid addition to the library which will be loved by developers!
Appreciate how structured you made the PR with tasks and explanations! 🔥
There is one task left, to create functions, is it just for demonstration purposes or you're planning to implement that as well, should we merge the PR?
We're approving this PR and will merge it as soon as we hear from you ✅
…api-3 # Conflicts: # Demo/DemoChat/Sources/ChatStore.swift Chat -> ChatQuery.ChatCompletionMessageParam refactr
… feat/assistants-api-3 # Conflicts: # Demo/DemoChat/Sources/ChatStore.swift # Sources/OpenAI/Public/Models/ChatQuery.swift # Sources/OpenAI/Public/Models/ChatResult.swift # Sources/OpenAI/Public/Models/ImagesQuery.swift # Sources/OpenAI/Public/Models/ThreadsQuery.swift # Tests/OpenAITests/OpenAITests.swift # Tests/OpenAITests/OpenAITestsCombine.swift # Tests/OpenAITests/OpenAITestsDecoder.swift
Quality Gate passedIssues Measures |
@cdillard have you been looking at the new Assistants Streaming functionality? Any plans to add? |
@alelordelo here's an example, assuming that you have started a run with let run = try await openAI.runRetrieve(threadId: threadId, runId: runId)
switch run.status {
case .requiresAction:
guard let toolCalls = run.requiredAction?.submitToolOutputs.toolCalls else {
break
}
for toolCall in toolCalls where toolCall.type == "function" {
// Arguments can be accessed like this as a string and parsed into JSON as needed.
let arguments = toolCall.function.arguments
}
default:
break
} |
thank @cdillard! I was hoping to access it in ChatBubble like:
The issue is that case .tool is actually incorrect, it doesn't represent a tool response (either in Assistant or Completion API)....
As for your suggestion, the run doesn't seem to be accessible on DetailView, and its not clear how the thread was created and how we could access in DetailView? Maybe would make sense to create a AssistantDetailView?
|
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.
Can someone merge this please? @ingvarus-bc
What
Eight new API endpoints are exposed in the APIPath to support the assistants API.
Thanks again to @bwhtmnv for his contribution to my fork assistants API PR. Functions are now supported upon assistant creation and when interacting with thread messages! All the credit goes to him for implementing the new Tool parameters for assistants and RunToolOutputsQuery for making functions useful within assistant threads.
The
OpenAIProtocol
is modified as follows: addedAssistants:
Create
Modify
Attach files of all supported OpenAI types to Assistants on creation or modify.
List assistants
Tools can be passed to assistant creation/modify.
Threads/Runs
Files
Example App:
A new demonstration of the assistants API and its requirements of the polling has been added to the Demo app.
Now you can create a new assistant on the Chats tab by selecting "+" -> New Assistant -> Fill in details -> OK.
This should result in a "New Assistant" row being added to the chats, you can chat with your newly created assistant in this conversation.
You can now list your OpenAI API Assistants on the "Assistants" tab. Select "+" -> Get Assistants to load the assistants list.
For now I've implemented additional chat messages that are shown when run steps include tool calls such as code interpreter or retrieval.
Why
To support the assistant features like threads, runs, tools (such as code_interpreter and retrieval), and files with assistants API.
Affected Areas
OpenAI