add gemeni pro support (#1307)

This commit is contained in:
Shuchang Zheng
2024-12-02 15:51:18 -08:00
committed by GitHub
parent 7f6b2c0929
commit 57e6404881
4 changed files with 37 additions and 0 deletions

View File

@@ -33,6 +33,11 @@ AZURE_GPT4O_MINI_API_KEY=""
AZURE_GPT4O_MINI_API_BASE=""
AZURE_GPT4O_MINI_API_VERSION=""
# ENABLE_GEMINI: Set to true to enable Gemini as a language model provider.
ENABLE_GEMINI=false
# GEMINI_API_KEY: Your Gemini API key for accessing models like GPT-4.
GEMINI_API_KEY=""
# LLM_KEY: The chosen language model to use. This should be one of the models
# provided by the enabled LLM providers (e.g., OPENAI_GPT4_TURBO, OPENAI_GPT4V, ANTHROPIC_CLAUDE3, AZURE_OPENAI_GPT4V).
LLM_KEY=""

View File

@@ -284,6 +284,7 @@ More extensive documentation can be found on our [documentation website](https:/
| `ENABLE_ANTHROPIC` | Register Anthropic models| Boolean | `true`, `false` |
| `ENABLE_AZURE` | Register Azure OpenAI models | Boolean | `true`, `false` |
| `ENABLE_BEDROCK` | Register AWS Bedrock models| Boolean | `true`, `false` |
| `ENABLE_GEMINI` | Register Gemini models| Boolean | `true`, `false` |
| `LLM_KEY` | The name of the model you want to use | String | Currently supported llm keys: `OPENAI_GPT4_TURBO`, `OPENAI_GPT4V`, `OPENAI_GPT4O`, `OPENAI_GPT4O_MINI`, `ANTHROPIC_CLAUDE3`, `ANTHROPIC_CLAUDE3_OPUS`, `ANTHROPIC_CLAUDE3_SONNET`, `ANTHROPIC_CLAUDE3_HAIKU`, `ANTHROPIC_CLAUDE3.5_SONNET`, `BEDROCK_ANTHROPIC_CLAUDE3_OPUS`, `BEDROCK_ANTHROPIC_CLAUDE3_SONNET`, `BEDROCK_ANTHROPIC_CLAUDE3_HAIKU`, `BEDROCK_ANTHROPIC_CLAUDE3.5_SONNET`, `AZURE_OPENAI` |
| `OPENAI_API_KEY` | OpenAI API Key | String | `sk-1234567890` |
| `OPENAI_API_BASE` | OpenAI API Base, optional | String | `https://openai.api.base` |
@@ -293,6 +294,7 @@ More extensive documentation can be found on our [documentation website](https:/
| `AZURE_DEPLOYMENT` | Azure OpenAI Deployment Name | String | `skyvern-deployment`|
| `AZURE_API_BASE` | Azure deployment api base url| String | `https://skyvern-deployment.openai.azure.com/`|
| `AZURE_API_VERSION` | Azure API Version| String | `2024-02-01`|
| `GEMINI_API_KEY` | Gemini API Key| String | `your_google_gemini_api_key`|
# Feature Roadmap
This is our planned roadmap for the next few months. If you have any suggestions or would like to see a feature added, please don't hesitate to reach out to us [via email](mailto:founders@skyvern.com) or [discord](https://discord.gg/fG2XXEuQX3).

View File

@@ -98,6 +98,23 @@ setup_llm_providers() {
update_or_add_env_var "ENABLE_AZURE" "false"
fi
#Gemini Configuartion
echo "To enable Gemini, you must have an Gemini API key."
read -p "Do you want to enable Gemini (y/n)? " enable_gemini
if [[ "$enable_gemini" == "y" ]]; then
read -p "Enter your Gemini API key: " gemini_api_key
if [ -z "$gemini_api_key" ]; then
echo "Error: Gemini API key is required."
echo "Gemini will not be enabled."
else
update_or_add_env_var "GEMINI_API_KEY" "$gemini_api_key"
update_or_add_env_var "ENABLE_GEMINI" "true"
model_options+=("GEMINI_PRO")
fi
else
update_or_add_env_var "ENABLE_GEMINI" "false"
fi
# Model Selection
if [ ${#model_options[@]} -eq 0 ]; then
echo "No LLM providers enabled. You won't be able to run Skyvern unless you enable at least one provider. You can re-run this script to enable providers or manually update the .env file."

View File

@@ -51,6 +51,7 @@ if not any(
settings.ENABLE_AZURE,
settings.ENABLE_AZURE_GPT4O_MINI,
settings.ENABLE_BEDROCK,
settings.ENABLE_GEMINI,
]
):
raise NoProviderEnabledError()
@@ -246,3 +247,15 @@ if settings.ENABLE_AZURE_GPT4O_MINI:
add_assistant_prefix=False,
),
)
if settings.ENABLE_GEMINI:
LLMConfigRegistry.register_config(
"GEMINI_PRO",
LLMConfig(
"gemini/gemini-pro-vision",
["GEMINI_API_KEY"],
supports_vision=True,
add_assistant_prefix=False,
max_output_tokens=8192,
),
)