Skip to content

Commit

Permalink
chat: freer models (fixes #7603) (#7604)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <dogi@users.noreply.github.com>
  • Loading branch information
Mutugiii and dogi authored Oct 22, 2024
1 parent ebe7353 commit c32942a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 26 deletions.
25 changes: 7 additions & 18 deletions chatapi/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
## Couchdb Notes

Ensure you have set the following configs in the `configurations` database in couchdb:
Ensure you have set the chatapi configs via the manager -> AI Configurations or in the `configurations` database in couchdb:

For model choices view:
Openai: https://platform.openai.com/docs/models
Perplexity: https://docs.perplexity.ai/guides/model-cards
Gemini: https://deepmind.google/technologies/gemini/

```
"keys": {
"openai": "sk-mm",
"perplexity": "pplx-21",
"gemini": "AIza"
},
"models": {
"openai": "gpt-3.5-turbo",
"perplexity": "llama-3-sonar-small-32k-online",
"gemini": "gemini-pro"
},
"assistant": {
"name": "Planet Context",
"instructions": "You are a brainstorming manager for Open Learning Exchange (OLE) - https://ole.org/, you have specialised knowledge in Planet(web app) and myPlanet(mobile app) applications developed by OLE. You are designed to generate innovative ideas and provide suggestions and help the community members so as to ensure OLE's mission of empowering communities. Emphasize on terms like 'learning,' 'learner,' 'coach,' 'leader,' 'community,' 'power,' 'team,' and 'enterprises,' and avoids overly technical jargon. You are to embody OLE's ethos of self-reliance, mentoring, and community leadership, steering clear of concepts that contradict these values. Communicates in a formal tone, treating users with respect and professionalism, and maintaining a supportive, solution-oriented approach. Ask for clarifications when necessary to ensure contributions are accurate and relevant, and always encourages community-focused, empowering brainstorming."
}
```

Note: This applies for both production and development environments.

Expand Down Expand Up @@ -80,7 +69,7 @@ In the production environment these configs are set in the `planet.yml` file.
- **context**: string(optional) -> The text context you would like to pre-load the AI Assistant with
- **aiProvider**: Object(required)
- **name**: string(required) -> Name of the API provider to choose from i.e openai, perplexity or gemini.
- **model**: string(optional) -> Name of the specific provider model to use. Defaults to gpt-3.5-turbo for _openai_, llama-3-sonar-small-32k-online for _peplexity_ and gemini-pro for _google gemini_
- **model**: string(optional) -> Name of the specific provider model to use.
- **_id**: couchdb document id
- **_rev**: couchdb revision id
The couchdb id and rev are optional fields(only optional when starting a new chat), however to update an existing chat the id and rev (required) be provided.
Expand Down
6 changes: 3 additions & 3 deletions chatapi/src/config/ai-providers.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ const initialize = async () => {
};

models = {
'openai': { 'ai': keys.openai, 'defaultModel': doc?.models.openai || 'gpt-3.5-turbo' },
'perplexity': { 'ai': keys.perplexity, 'defaultModel': doc?.models.perplexity || 'llama-3-sonar-small-32k-online' },
'gemini': { 'ai': keys.gemini, 'defaultModel': doc?.models.gemini || 'gemini-pro' },
'openai': { 'ai': keys.openai, 'defaultModel': doc?.models.openai || '' },
'perplexity': { 'ai': keys.perplexity, 'defaultModel': doc?.models.perplexity || '' },
'gemini': { 'ai': keys.gemini, 'defaultModel': doc?.models.gemini || '' },
};

assistant = {
Expand Down
2 changes: 1 addition & 1 deletion chatapi/src/utils/chat-helpers.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export async function aiChatNonStream(

return await retrieveResponse(thread.id);
} catch (error) {
return `Error processing request ${error}`;
throw new Error(`Error processing request ${error}`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "planet",
"license": "AGPL-3.0",
"version": "0.14.96",
"version": "0.14.97",
"myplanet": {
"latest": "v0.20.51",
"min": "v0.19.51"
Expand Down
6 changes: 3 additions & 3 deletions src/app/configuration/configuration.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ export class ConfigurationComponent implements OnInit {
gemini: ''
},
models: {
openai: 'gpt-3.5-turbo',
perplexity: 'llama-3-sonar-small-32k-online',
gemini: 'gemini-pro'
openai: '',
perplexity: '',
gemini: ''
},
assistant: {
name: 'Planet Context',
Expand Down

0 comments on commit c32942a

Please sign in to comment.