using AIStudio.Models; namespace AIStudio.Assistants.BeyondFactsLab; /// /// What a model needs to run the chats of the BeyondFacts Lab. /// /// /// Every chat of a step keeps the guide of the lab in the context, which alone takes about 20,000 tokens. A model /// with a smaller context window would lose the beginning of each conversation, or fail right away. The conversation /// about whether the lab fits a task leaves out the guide, so it runs with any model; its token budget tells the /// person when it grows too long. /// public static class BflModelRequirements { /// /// The smallest context window the lab accepts, in tokens. /// /// /// The fixed part of the longest system prompt may take about 22,000 tokens, see BflPromptLibraryTests; the /// rest is left for the details of the person and the conversation. /// public const int MINIMUM_CONTEXT_TOKENS = 32_000; /// /// Checks whether a model reads enough at once for the lab. /// /// /// A window nobody knows is accepted: many self-hosted models have no statement, and the token budget of the chat /// tells the person when a conversation grows too long. /// /// The context window of the model. /// True when the window is large enough or unknown. public static bool HasEnoughContext(ContextWindow contextWindow) => !contextWindow.IsKnown || contextWindow.DefaultTokens >= MINIMUM_CONTEXT_TOKENS; /// /// Checks whether a model reads enough at once for a chat of the lab. /// /// Where the chat belongs. /// The context window of the model. /// True when the chat needs no minimum, or when the window is large enough or unknown. public static bool HasEnoughContext(BflThreadLocation location, ContextWindow contextWindow) => location is BflOnboardingThreadLocation || HasEnoughContext(contextWindow); }