deep-foundation / deep-foundation/chatgpt

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).

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
8
Forks
1
PR merge metrics
No merged PRs in 30d

Description

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

```javascript
const APP_URL = 'https://chat.deep.foundation';
const APP_NAME = 'Deep.Foundation';
```

```javascript
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}`);
}
```

```javascript
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);
}
```

```javascript
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_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.