Spaces:
Runtime error
Runtime error
File size: 1,070 Bytes
cd6f98e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import type { Session } from "next-auth";
import type { Analysis } from "../services/agent/analysis";
import type { GPTModelNames, ModelSettings } from "../types";
export interface ApiModelSettings {
language: string;
model: GPTModelNames;
temperature: number;
max_tokens: number;
}
export const toApiModelSettings = (modelSettings: ModelSettings, session?: Session) => {
const allowCustomization = session?.user;
return {
language: modelSettings.language.name,
model: allowCustomization ? modelSettings.customModelName : "gpt-3.5-turbo",
temperature: modelSettings.customTemperature,
max_tokens: allowCustomization ? modelSettings.maxTokens : 500,
custom_api_key: modelSettings.customApiKey,
};
};
export interface RequestBody {
run_id?: string;
model_settings: ApiModelSettings;
goal: string;
task?: string;
tasks?: string[];
last_task?: string;
result?: string;
results?: string[];
completed_tasks?: string[];
analysis?: Analysis;
tool_names?: string[];
message?: string; // Used for the chat endpoint
}
|