Skip to content

Commit

Permalink
Agent config: V2 for lib to get / create / update the config
Browse files Browse the repository at this point in the history
  • Loading branch information
PopDaph committed Sep 8, 2023
1 parent b4bb27a commit 7ddda0d
Show file tree
Hide file tree
Showing 4 changed files with 698 additions and 62 deletions.
4 changes: 2 additions & 2 deletions front/admin/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ async function main() {
await ExtractedEvent.sync({ alter: true });
await DocumentTrackerChangeSuggestion.sync({ alter: true });

await AgentConfiguration.sync({ alter: true });
await AgentGenerationConfiguration.sync({ alter: true });

await AgentRetrievalConfiguration.sync({ alter: true });
await AgentDataSourceConfiguration.sync({ alter: true });
await AgentConfiguration.sync({ alter: true });

await AgentRetrievalAction.sync({ alter: true });
await RetrievalDocument.sync({ alter: true });
await RetrievalDocumentChunk.sync({ alter: true });
Expand Down
58 changes: 0 additions & 58 deletions front/lib/api/assistant/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ import { Err, Ok, Result } from "@app/lib/result";
import { generateModelSId } from "@app/lib/utils";
import { isRetrievalConfiguration } from "@app/types/assistant/actions/retrieval";
import {
AgentActionConfigurationType,
AgentActionSpecification,
AgentConfigurationStatus,
AgentConfigurationType,
AgentGenerationConfigurationType,
} from "@app/types/assistant/agent";
import {
AgentActionType,
Expand All @@ -31,61 +28,6 @@ import {
UserMessageType,
} from "@app/types/assistant/conversation";

/**
* Agent configuration.
*/

export async function createAgentConfiguration(
auth: Authenticator,
{
name,
pictureUrl,
action,
generation,
}: {
name: string;
pictureUrl?: string;
action?: AgentActionConfigurationType;
generation?: AgentGenerationConfigurationType;
}
): Promise<AgentConfigurationType> {
return {
sId: generateModelSId(),
name,
pictureUrl: pictureUrl ?? null,
status: "active",
action: action ?? null,
generation: generation ?? null,
};
}

export async function updateAgentConfiguration(
auth: Authenticator,
configurationId: string,
{
name,
pictureUrl,
status,
action,
generation,
}: {
name: string;
pictureUrl?: string;
status: AgentConfigurationStatus;
action?: AgentActionConfigurationType;
generation?: AgentGenerationConfigurationType;
}
): Promise<AgentConfigurationType> {
return {
sId: generateModelSId(),
name,
pictureUrl: pictureUrl ?? null,
status,
action: action ?? null,
generation: generation ?? null,
};
}

/**
* Action Inputs generation.
*/
Expand Down
Loading

0 comments on commit 7ddda0d

Please sign in to comment.