Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ web_modules/

# Stores VSCode versions used for testing VSCode extensions
.vscode-test
.vscode

# yarn v2
.yarn/cache
Expand Down
3 changes: 2 additions & 1 deletion src/agents/openai/OpenAIAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ export class OpenAIAgent implements AIAgent {
message_id: channelMessage.id,
});

const run = this.openai.beta.threads.runs.stream(this.openAiThread.id, {
const run = await this.openai.beta.threads.runs.create(this.openAiThread.id, {
assistant_id: this.assistant.id,
stream: true
});

const handler = new OpenAIResponseHandler(
Expand Down
3 changes: 2 additions & 1 deletion src/agents/openai/OpenAIResponseHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import axios from 'axios';
import OpenAI from 'openai';
import type { AssistantStream } from 'openai/lib/AssistantStream';
import { Stream } from 'openai/streaming';
import type { Channel, MessageResponse, StreamChat } from 'stream-chat';

export class OpenAIResponseHandler {
Expand All @@ -11,7 +12,7 @@ export class OpenAIResponseHandler {
constructor(
private readonly openai: OpenAI,
private readonly openAiThread: OpenAI.Beta.Threads.Thread,
private readonly assistantStream: AssistantStream,
private readonly assistantStream: AssistantStream | Stream<OpenAI.Beta.Assistants.AssistantStreamEvent>,
private readonly chatClient: StreamChat,
private readonly channel: Channel,
private readonly message: MessageResponse,
Expand Down