Skip to content

Some constants are not constants, and should be configurable. Most constants should be stored in links. Because constants also change (people add new constants over time, and delete|deprecate old ones). #6

@konard

Description

@konard

Is your feature request related to a problem? Please describe.

const APP_URL = 'https://chat.deep.foundation';
const APP_NAME = 'Deep.Foundation';
if (model === 'gpt-3.5-turbo') {
  MAX_TOKENS = 16000;
} else if (model === 'gpt-4') {
  MAX_TOKENS = 8192;
} else if (model === 'openai/gpt-3.5-turbo') {
  MAX_TOKENS = 16000;
} else if (model === 'openai/gpt-3.5-turbo-16k') {
  MAX_TOKENS = 16000;
} else if (model === 'openai/gpt-4') {
  MAX_TOKENS = 8192;
} else if (model === 'openai/gpt-4-32k') {
  MAX_TOKENS = 32000;
} else if (model === 'anthropic/claude-2') {
  MAX_TOKENS = 8000;
} else if (model === 'anthropic/claude-instant-v1') {
  MAX_TOKENS = 8000; 
} else if (model === 'google/palm-2-chat-bison') {
  MAX_TOKENS = 8000; 
} else if (model === 'google/palm-2-codechat-bison') {
  MAX_TOKENS = 8000; 
} else if (model === 'meta-llama/llama-2-13b-chat') {
  MAX_TOKENS = 13000; 
} else if (model === 'meta-llama/llama-2-70b-chat') {
  MAX_TOKENS = 70000; 
} else {
  throw new Error(`Unsupported model: ${model}`);
}
if (model === 'gpt-3.5-turbo' || model === 'gpt-4') {
  response = await openai.createChatCompletion({
    model: model,
    messages: [
      ...messagesToSendToOpenAI
    ],
  });
} else if (
  model === 'openai/gpt-3.5-turbo' || model === 'openai/gpt-3.5-turbo-16k' ||
  model === 'openai/gpt-4' || model === 'openai/gpt-4-32k' ||
  model === 'anthropic/claude-2' || model === 'anthropic/claude-instant-v1' ||
  model === 'google/palm-2-chat-bison' || model === 'google/palm-2-codechat-bison' ||
  model === 'meta-llama/llama-2-13b-chat' || model === 'meta-llama/llama-2-70b-chat'
) {
  const body = {
    model: model,
    messages: [
      ...messagesToSendToOpenAI
    ],
  };

  response = await getResponse(body);
}
const apiResponse = await axios.post('https://openrouter.ai/api/v1/chat/completions', body, {

All these constants/variables should be stored as links. When we store these data in links we will not need to update the code then new constants will be added, we just add links. User also will see links and will be use predefined links, so user does not have to create each such link manually. It is much easier to see links than to read code. This will make less reasons for code to be updated, and the package will be possible to support with fewer programmers.

Route for API call should be configurable. And everything that is linked to openrouter should be in a separate package. Everything that is configurable should be configurable using links, not the code. Every constant should be in links where we are sure that new constants will be added. It would be much easier to update the package without breaking the compatibility.

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions