diff --git a/connectors/src/connectors/slack/bot.ts b/connectors/src/connectors/slack/bot.ts index 353b283e19be..54d0b23c3594 100644 --- a/connectors/src/connectors/slack/bot.ts +++ b/connectors/src/connectors/slack/bot.ts @@ -1,9 +1,11 @@ -import type { PublicPostContentFragmentRequestBody } from "@dust-tt/client"; +import type { + ConversationPublicType, + PublicPostContentFragmentRequestBody, +} from "@dust-tt/client"; import { DustAPI } from "@dust-tt/client"; import type { AgentMessageSuccessEvent, APIError, - ConversationType, LightAgentConfigurationType, ModelId, Result, @@ -588,7 +590,7 @@ async function answerMessage( return buildSlackMessageError(buildContentFragmentRes); } - let conversation: ConversationType | undefined = undefined; + let conversation: ConversationPublicType | undefined = undefined; let userMessage: UserMessageType | undefined = undefined; if (lastSlackChatBotMessage?.conversationId) { diff --git a/connectors/src/connectors/slack/chat/citations.ts b/connectors/src/connectors/slack/chat/citations.ts index c3de21be8ccd..fb02025a5c52 100644 --- a/connectors/src/connectors/slack/chat/citations.ts +++ b/connectors/src/connectors/slack/chat/citations.ts @@ -1,4 +1,4 @@ -import type { AgentActionType } from "@dust-tt/types"; +import type { AgentActionPublicType } from "@dust-tt/client"; import { getTitleFromRetrievedDocument, isRetrievalActionType, @@ -15,7 +15,7 @@ export type SlackMessageFootnotes = SlackMessageFootnote[]; export function annotateCitations( content: string, - actions: AgentActionType[] + actions: AgentActionPublicType[] ): { formattedContent: string; footnotes: SlackMessageFootnotes } { const references: { [key: string]: { diff --git a/connectors/src/connectors/slack/chat/stream_conversation_handler.ts b/connectors/src/connectors/slack/chat/stream_conversation_handler.ts index 62c3a2cec71f..3ef2dc8f9296 100644 --- a/connectors/src/connectors/slack/chat/stream_conversation_handler.ts +++ b/connectors/src/connectors/slack/chat/stream_conversation_handler.ts @@ -1,8 +1,10 @@ -import type { DustAPI } from "@dust-tt/client"; import type { - AgentActionType, - AgentMessageType, - ConversationType, + AgentActionPublicType, + AgentMessagePublicType, + ConversationPublicType, + DustAPI, +} from "@dust-tt/client"; +import type { LightAgentConfigurationType, Result, UserMessageType, @@ -27,7 +29,7 @@ import type { ConnectorResource } from "@connectors/resources/connector_resource interface StreamConversationToSlackParams { assistantName: string; connector: ConnectorResource; - conversation: ConversationType; + conversation: ConversationPublicType; mainMessage: ChatPostMessageResponse; slack: { slackChannelId: string; @@ -137,7 +139,7 @@ export async function streamConversationToSlack( if (agentMessages.length === 0) { return new Err(new Error("Failed to retrieve agent message")); } - const agentMessage = agentMessages[0] as AgentMessageType; + const agentMessage = agentMessages[0] as AgentMessagePublicType; const streamRes = await dustAPI.streamAgentMessageEvents({ conversation, @@ -149,7 +151,7 @@ export async function streamConversationToSlack( } let answer = ""; - const actions: AgentActionType[] = []; + const actions: AgentActionPublicType[] = []; for await (const event of streamRes.value.eventStream) { switch (event.type) { case "retrieval_params": diff --git a/sdks/js/src/index.ts b/sdks/js/src/index.ts index 0fb72851c3b7..709abb544ac0 100644 --- a/sdks/js/src/index.ts +++ b/sdks/js/src/index.ts @@ -4,8 +4,8 @@ import type { AgentActionSpecificEvent, AgentActionSuccessEvent, AgentErrorEvent, + AgentMessagePublicType, AgentMessageSuccessEvent, - AgentMessageType, APIError, ConversationPublicType, DataSourceViewType, @@ -530,7 +530,7 @@ export class DustAPI { message, }: { conversation: ConversationPublicType; - message: AgentMessageType; + message: AgentMessagePublicType; }) { const res = await this.request({ method: "GET", diff --git a/sdks/js/src/types.ts b/sdks/js/src/types.ts index ab1a292c30da..8215e579493f 100644 --- a/sdks/js/src/types.ts +++ b/sdks/js/src/types.ts @@ -737,6 +737,7 @@ const AgentActionTypeSchema = z.union([ WebsearchActionTypeSchema, BrowseActionTypeSchema, ]); +export type AgentActionPublicType = z.infer; const AgentMessageStatusSchema = FlexibleEnumSchema([ "created", @@ -772,7 +773,7 @@ const AgentMessageTypeSchema = z.object({ }) .nullable(), }); -export type AgentMessageType = z.infer; +export type AgentMessagePublicType = z.infer; const ConversationVisibilitySchema = FlexibleEnumSchema([ "unlisted", @@ -1390,7 +1391,7 @@ export type PublicPostMessagesRequestBody = z.infer< export type PostMessagesResponseBody = { message: UserMessageType; - agentMessages?: AgentMessageType[]; + agentMessages?: AgentMessagePublicType[]; }; export const PublicPostContentFragmentRequestBodySchema = z.object({