Skip to content

Commit

Permalink
add support for gemini style api, partially implements #1
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmysun committed Aug 1, 2024
1 parent 09c5b60 commit 6057a38
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,20 @@ See [Configuration](docs/Configuration.md).

Here's an example configuration to use `gpt-4o-mini` from OpenAI. You need to set these variables in your `~/.ellrc`:

```ini
ELL_API_STYLE=gemini
ELL_LLM_MODEL=gemini-pro
ELL_TEMPLATE=default-gemini
ELL_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ELL_API_URL=https://generativelanguage.googleapis.com/v1/models/
```

Here's an example configuration to use `gpt-4o-mini` from OpenAI.

```ini
ELL_API_STYLE=openai
ELL_LLM_MODEL=gpt-4o-mini
ELL_TEMPLATE=default-openai
ELL_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ELL_API_URL=https://api.openai.com/v1/chat/completions
```
Expand Down
2 changes: 1 addition & 1 deletion ell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ELL_VERSION="0.0.1";
: "${ELL_LLM_TEMPERATURE:=0.6}";
: "${ELL_LLM_MAX_TOKENS:=4096}";
: "${ELL_TEMPLATE_PATH:=~/.ellrc.d/templates}";
: "${ELL_TEMPLATE:=default}";
: "${ELL_TEMPLATE:=default-openai}";
: "${ELL_INPUT_FILE:=""}";
: "${ELL_RECORD:="false"}";
: "${ELL_INTERACTIVE:="false"}";
Expand Down
12 changes: 12 additions & 0 deletions templates/default-gemini.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "You are a helpful assistant. Try to explain what happens. Follow the dialog. Be helpful. The user requests are generated with an application called \"ell\" from their command line. An example usage of this application is \"ell PROMPT\". Always ignore this command prompt and focus on other contents. Just pretend as if you never see the lines with \"ell\". Always ignore this command prompt and focus on other contents. Just pretend as if you never see the lines with \"ell\". Always ignore this command prompt and focus on other contents. Just pretend as if you never see the lines with \"ell\". Answer the user questions. If you don't know the answer, you can say \"I don't know\". \n\nContext information from terminal: \n\n---\n\n${SHELL_CONTEXT}\n\n---\n\n${USER_PROMPT}"
}
]
}
]
}
File renamed without changes.

0 comments on commit 6057a38

Please sign in to comment.