-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* enh: gpt-4-turbo * more clean-up * migrations to move assistants to gpt-4-turbo * Preserve the routing from 32k to 4 * nit
- Loading branch information
Showing
5 changed files
with
85 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
front/migrations/20231113_migrate_assistants_to_gpt4_turbo.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { | ||
AgentConfiguration, | ||
AgentGenerationConfiguration, | ||
Workspace, | ||
} from "@app/lib/models"; | ||
import { Err } from "@app/lib/result"; | ||
|
||
const { LIVE, WORKSPACE } = process.env; | ||
|
||
async function main() { | ||
if (!WORKSPACE) { | ||
throw new Err("WORKSPACE is required"); | ||
} | ||
const wId = WORKSPACE; | ||
|
||
console.log(`Updateing agents for workspace ${wId}...`); | ||
const w = await Workspace.findOne({ where: { sId: wId } }); | ||
if (!w) { | ||
throw new Error(`Workspace ${wId} not found`); | ||
} | ||
|
||
const agentConfigurations = await AgentConfiguration.findAll({ | ||
where: { workspaceId: w.id }, | ||
}); | ||
|
||
for (const c of agentConfigurations) { | ||
if (!c.generationConfigurationId) { | ||
console.log( | ||
"Skipping agent (no generation configuration)", | ||
c.sId, | ||
c.name | ||
); | ||
continue; | ||
} | ||
|
||
const g = await AgentGenerationConfiguration.findOne({ | ||
where: { id: c.generationConfigurationId }, | ||
}); | ||
|
||
if (!g) { | ||
throw new Error( | ||
`Generation configuration ${c.generationConfigurationId} not found` | ||
); | ||
} | ||
|
||
if (g.modelId === "gpt-4" || g.modelId === "gpt-4-32k") { | ||
if (LIVE) { | ||
await g.update({ modelId: "gpt-4-1106-preview" }); | ||
console.log("Updated", c.sId, c.name); | ||
} else { | ||
console.log("Would update", c.sId, c.name); | ||
} | ||
} | ||
} | ||
} | ||
|
||
main() | ||
.then(() => { | ||
console.log("Done"); | ||
process.exit(0); | ||
}) | ||
.catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); |