Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Konard opened this issue Aug 11, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@Konard
Copy link
Member

Konard commented Aug 11, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant