Skip to content
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

runGeneration implementation and associated Dust app #1302

Merged
merged 5 commits into from
Sep 7, 2023
Merged

Conversation

spolu
Copy link
Contributor

@spolu spolu commented Sep 7, 2023

Fixes #1300

Dust app: https://dust.tt/w/78bda07b39/a/6a27050429

The Dust app is on purpose extremely simple. It is possible that we may want in the future a meta prompt to properly handle "references" but this is for future us.

@spolu spolu changed the title runGeneration implementation and associated Dust app [WIP] runGeneration implementation and associated Dust app Sep 7, 2023
@spolu spolu changed the title [WIP] runGeneration implementation and associated Dust app runGeneration implementation and associated Dust app Sep 7, 2023
@spolu spolu requested a review from PopDaph September 7, 2023 12:11
PopDaph
PopDaph previously approved these changes Sep 7, 2023
@@ -33,6 +33,8 @@ import {
UserMessageType,
} from "@app/types/assistant/conversation";

import { ModelMessageType } from "../generation";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: relative import

@@ -507,7 +509,7 @@ export async function* runRetrieval(
id: 0, // dummy pending database insertion
dataSourceId: d.data_source_id,
documentId: d.document_id,
reference: "",
reference: new_id().slice(0, 3),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: In the type this field is described as is: "Short random string so that the model can refer to the document."
As "reference" is not self-explanatory, what do you think about calling sId and have it sliced to 10 char?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we want it to be much shorter. The idea is for the model (with proper prompting) to generate references using eg [a32] or [ef2]. We want it short so that the generation is snappy and we can render it as a nice reference in the UI.

This is quite WIP of course.

created: number;
configurationId: string;
messageId: string;
text: string;
};

// Event sent once the message is completed and successful.
export type AgentGenerationSuccessEvent = {
type: "agent_generation_success";
export type AgentSuccessEvent = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Looking at the comment, should it be "AgentMessageSuccessEvent"? (asking as "once the message is completed and successful" means it is attached to the generation, right?)

Or will we use this event also after a successful action and it's the comment that needs to be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to call it AgentMessageSuccessEvent 👍 The idea is for this one to be the final success event of the agent meaning that everything is ready and done. Since we have succeeded on AgentMessage, let's add Message in the event name here 👍

messages: selected,
});
}
import { GenerationTokensEvent } from "./generation";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: relative import

*/

export type ModelMessageType = {
role: "action" | "agent" | "user";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will be action? 🙏🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output of actions


const now = Date.now();

// This is a bit aggressive but fuck it.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😆

@spolu
Copy link
Contributor Author

spolu commented Sep 7, 2023

Addressed || commented on your comments

@spolu spolu merged commit 9d35348 into main Sep 7, 2023
1 check passed
@spolu spolu deleted the spolu-generation branch September 7, 2023 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement generation functions and Dust app
2 participants