diff --git a/.gitignore b/.gitignore index 5c0a7bed..e7864c5a 100644 --- a/.gitignore +++ b/.gitignore @@ -163,3 +163,10 @@ azure/*/.secrets azure/*.secrets azure/*/Pulumi.*.yaml data/llama_index_indices/all_data/ + +# environment files +*.env +*_env + +# misc +.vscode/ diff --git a/azure/README.md b/azure/README.md index 4c654aec..bda24393 100644 --- a/azure/README.md +++ b/azure/README.md @@ -5,17 +5,49 @@ You will need to install in order to run this code. -1. Setup the Pulumi backend (if it already exists this will just check that you have access) +1. Have a .pulumi_env file (in this directory) including the variables that you need. + +For the `api_bot` model, you will need to have the following variables: + +```bash +REGINALD_SLACK_APP_TOKEN +REGINALD_SLACK_BOT_TOKEN +REGINALD_API_URL +GITHUB_TOKEN +``` + +For the `hack_week` model, you will need to have the following variables: + +```bash +OPENAI_AZURE_API_BASE +OPENAI_AZURE_API_KEY +COMPLETION_SLACK_APP_TOKEN +COMPLETION_SLACK_BOT_TOKEN +GPT_AZURE_SLACK_APP_TOKEN +GPT_AZURE_SLACK_BOT_TOKEN +GITHUB_TOKEN +OPENAI_API_KEY (optional) +``` + +2. Move into the folder for the model you want to deploy, e.g. for the `api_bot` model: + +```bash +cd api_bot +``` + +3. Setup the Pulumi backend (if it already exists this will just check that you have access) ```bash ./setup.sh ``` -this will also create a local `.secrets` file +This may create a local `.secrets` file. +This file contains the secrets that you need to deploy the model and includes the environment variables needed for the container instance (see Step 1.). +You will need to source this file before deploying in the next step. -2. Deploy with Pulumi +4. Deploy with Pulumi ```bash -> source .secrets -> AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi update +> source .secrets (if this exists) +> AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi up ``` diff --git a/azure/api_bot/Pulumi.yaml b/azure/api_bot/Pulumi.yaml deleted file mode 100644 index f00e8292..00000000 --- a/azure/api_bot/Pulumi.yaml +++ /dev/null @@ -1,4 +0,0 @@ -name: reginald -runtime: - name: python -description: Slack bot to respond to REG queries diff --git a/azure/api_bot/__main__.py b/azure/api_bot/__main__.py deleted file mode 100644 index a9b3d073..00000000 --- a/azure/api_bot/__main__.py +++ /dev/null @@ -1,89 +0,0 @@ -import pulumi -from pulumi_azure_native import containerinstance, network, resources, storage - -# Get some configuration variables -stack_name = pulumi.get_stack() -config = pulumi.Config() - - -# Create an resource group -resource_group = resources.ResourceGroup( - "resource_group", resource_group_name=f"rg-reginald-{stack_name}-deployment" -) - -# Create a network security group -network_security_group = network.NetworkSecurityGroup( - "network_security_group", - network_security_group_name=f"nsg-reginald-{stack_name}-containers", - resource_group_name=resource_group.name, -) - -# Create a virtual network and subnet -virtual_network = network.VirtualNetwork( - "virtual_network", - address_space=network.AddressSpaceArgs( - address_prefixes=["10.0.0.0/29"], - ), - resource_group_name=resource_group.name, - # Define subnets inline to avoid creation/deletion issues - subnets=[ - # Container subnet - network.SubnetArgs( - address_prefix="10.0.0.0/29", - delegations=[ - network.DelegationArgs( - name="SubnetDelegationContainerGroups", - service_name="Microsoft.ContainerInstance/containerGroups", - type="Microsoft.Network/virtualNetworks/subnets/delegations", - ), - ], - name="ContainersSubnet", - network_security_group=network.NetworkSecurityGroupArgs( - id=network_security_group.id - ), - ), - ], - virtual_network_name=f"vnet-reginald-{stack_name}", - virtual_network_peerings=[], -) - -# Define the container group -container_group = containerinstance.ContainerGroup( - "container_group", - container_group_name=f"aci-reginald-{stack_name}", - containers=[ - containerinstance.ContainerArgs( - image="ghcr.io/alan-turing-institute/reginald_slackbot:main", - name="reginald-llama-cpp", # maximum of 63 characters - environment_variables=[ - containerinstance.EnvironmentVariableArgs( - name="REGINALD_MODEL", - value="llama-index-llama-cpp", - ), - containerinstance.EnvironmentVariableArgs( - name="SLACK_APP_TOKEN", - secure_value=config.get_secret("LLAMA_CPP_SLACK_APP_TOKEN"), - ), - containerinstance.EnvironmentVariableArgs( - name="SLACK_BOT_TOKEN", - secure_value=config.get_secret("LLAMA_CPP_SLACK_BOT_TOKEN"), - ), - containerinstance.EnvironmentVariableArgs( - name="REGINALD_API_URL", - secure_value=config.get_secret("REGINALD_API_URL"), - ), - ], - ports=[], - resources=containerinstance.ResourceRequirementsArgs( - requests=containerinstance.ResourceRequestsArgs( - cpu=1, - memory_in_gb=4, - ), - ), - ), - ], - os_type=containerinstance.OperatingSystemTypes.LINUX, - resource_group_name=resource_group.name, - restart_policy=containerinstance.ContainerGroupRestartPolicy.ALWAYS, - sku=containerinstance.ContainerGroupSku.STANDARD, -) diff --git a/azure/hack_week/Pulumi.yaml b/azure/hack_week/Pulumi.yaml index f00e8292..d7a45a7c 100644 --- a/azure/hack_week/Pulumi.yaml +++ b/azure/hack_week/Pulumi.yaml @@ -1,4 +1,4 @@ -name: reginald +name: reginald_hack_week runtime: name: python -description: Slack bot to respond to REG queries +description: Slack bot to respond to REG queries. Models developed during REG Hack Week 2023. diff --git a/azure/hack_week/__main__.py b/azure/hack_week/__main__.py index e8c32fb3..ee6c9b2f 100644 --- a/azure/hack_week/__main__.py +++ b/azure/hack_week/__main__.py @@ -1,5 +1,11 @@ import pulumi -from pulumi_azure_native import containerinstance, network, resources, storage +from pulumi_azure_native import ( + automation, + containerinstance, + network, + resources, + storage, +) # Get some configuration variables stack_name = pulumi.get_stack() @@ -10,6 +16,16 @@ "resource_group", resource_group_name=f"rg-reginald-{stack_name}-deployment" ) +# Create an automation account +automation_account = automation.AutomationAccount( + "automation_account", + automation_account_name=f"aa-reginald-{stack_name}", + resource_group_name=resource_group.name, + sku=automation.SkuArgs( + name="Free", + ), +) + # Create a network security group network_security_group = network.NetworkSecurityGroup( "network_security_group", @@ -75,38 +91,39 @@ lambda keys: pulumi.Output.secret(keys.keys[0].value) ) -# Define the container group +# Define the container group for the slack bots container_group = containerinstance.ContainerGroup( - "container_group", - container_group_name=f"aci-reginald-{stack_name}", + "container_group-bots", + container_group_name=f"aci-reginald-{stack_name}-bots", containers=[ + # Reginald chat completion container containerinstance.ContainerArgs( image="ghcr.io/alan-turing-institute/reginald_reginald:main", - name="reginald-handbook", # maximum of 63 characters + name="reginald-completion", # maximum of 63 characters environment_variables=[ containerinstance.EnvironmentVariableArgs( - name="OPENAI_AZURE_API_BASE", - value=config.get_secret("OPENAI_AZURE_API_BASE"), + name="REGINALD_MODEL", + value="chat-completion-azure", ), containerinstance.EnvironmentVariableArgs( - name="OPENAI_AZURE_API_KEY", - secure_value=config.get_secret("OPENAI_AZURE_API_KEY"), + name="REGINALD_MODEL_NAME", + value="reginald-gpt4", ), containerinstance.EnvironmentVariableArgs( - name="OPENAI_API_KEY", - secure_value=config.get_secret("OPENAI_API_KEY"), + name="OPENAI_AZURE_API_BASE", + value=config.get_secret("OPENAI_AZURE_API_BASE"), ), containerinstance.EnvironmentVariableArgs( - name="REGINALD_MODEL", - value="chat-completion-azure", + name="OPENAI_AZURE_API_KEY", + secure_value=config.get_secret("OPENAI_AZURE_API_KEY"), ), containerinstance.EnvironmentVariableArgs( name="SLACK_APP_TOKEN", - secure_value=config.get_secret("HANDBOOK_SLACK_APP_TOKEN"), + secure_value=config.get_secret("COMPLETION_SLACK_APP_TOKEN"), ), containerinstance.EnvironmentVariableArgs( name="SLACK_BOT_TOKEN", - secure_value=config.get_secret("HANDBOOK_SLACK_BOT_TOKEN"), + secure_value=config.get_secret("COMPLETION_SLACK_BOT_TOKEN"), ), ], ports=[ @@ -118,29 +135,62 @@ resources=containerinstance.ResourceRequirementsArgs( requests=containerinstance.ResourceRequestsArgs( cpu=1, - memory_in_gb=4, + memory_in_gb=2, ), ), ), + # Reginald (public) container containerinstance.ContainerArgs( image="ghcr.io/alan-turing-institute/reginald_reginald:main", name="reginald-gpt-azure", # maximum of 63 characters environment_variables=[ containerinstance.EnvironmentVariableArgs( - name="OPENAI_AZURE_API_BASE", - value=config.get_secret("OPENAI_AZURE_API_BASE"), + name="REGINALD_MODEL", + value="llama-index-gpt-azure", ), containerinstance.EnvironmentVariableArgs( - name="OPENAI_AZURE_API_KEY", - secure_value=config.get_secret("OPENAI_AZURE_API_KEY"), + name="REGINALD_MODEL_NAME", + value="reginald-gpt4", ), containerinstance.EnvironmentVariableArgs( - name="OPENAI_API_KEY", - secure_value=config.get_secret("OPENAI_API_KEY"), + name="LLAMA_INDEX_MODE", + value="chat", ), containerinstance.EnvironmentVariableArgs( - name="REGINALD_MODEL", - value="llama-index-gpt-azure", + name="LLAMA_INDEX_FORCE_NEW_INDEX", + value="false", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_WHICH_INDEX", + value="public", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_MAX_INPUT_SIZE", + value="4096", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_K", + value="3", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_CHUNK_SIZE", + value="512", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_CHUNK_OVERLAP_RATIO", + value="0.1", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_NUM_OUTPUT", + value="512", + ), + containerinstance.EnvironmentVariableArgs( + name="OPENAI_AZURE_API_BASE", + value=config.get_secret("OPENAI_AZURE_API_BASE"), + ), + containerinstance.EnvironmentVariableArgs( + name="OPENAI_AZURE_API_KEY", + secure_value=config.get_secret("OPENAI_AZURE_API_KEY"), ), containerinstance.EnvironmentVariableArgs( name="SLACK_APP_TOKEN", @@ -155,12 +205,12 @@ resources=containerinstance.ResourceRequirementsArgs( requests=containerinstance.ResourceRequestsArgs( cpu=1, - memory_in_gb=4, + memory_in_gb=12, ), ), volume_mounts=[ containerinstance.VolumeMountArgs( - mount_path="/app/data/llama_index_indices", + mount_path="/app/data", name="llama-data", read_only=True, ), @@ -182,3 +232,73 @@ ), ], ) + +# Define the container group for the data creation +container_group = containerinstance.ContainerGroup( + "container_group-data", + container_group_name=f"aci-reginald-{stack_name}-data", + containers=[ + # public index creation container + containerinstance.ContainerArgs( + image="ghcr.io/alan-turing-institute/reginald_create_index:main", + name="reginald-create-index", # maximum of 63 characters + environment_variables=[ + containerinstance.EnvironmentVariableArgs( + name="GITHUB_TOKEN", + secure_value=config.get_secret("GITHUB_TOKEN"), + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_WHICH_INDEX", + value="public", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_MAX_INPUT_SIZE", + value="4096", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_K", + value="3", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_CHUNK_SIZE", + value="512", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_CHUNK_OVERLAP_RATIO", + value="0.1", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_NUM_OUTPUT", + value="512", + ), + ], + ports=[], + resources=containerinstance.ResourceRequirementsArgs( + requests=containerinstance.ResourceRequestsArgs( + cpu=4, + memory_in_gb=16, + ), + ), + volume_mounts=[ + containerinstance.VolumeMountArgs( + mount_path="/app/data", + name="llama-data", + ), + ], + ), + ], + os_type=containerinstance.OperatingSystemTypes.LINUX, + resource_group_name=resource_group.name, + restart_policy=containerinstance.ContainerGroupRestartPolicy.NEVER, + sku=containerinstance.ContainerGroupSku.STANDARD, + volumes=[ + containerinstance.VolumeArgs( + azure_file=containerinstance.AzureFileVolumeArgs( + share_name=file_share.name, + storage_account_key=storage_account_key, + storage_account_name=storage_account.name, + ), + name="llama-data", + ), + ], +) diff --git a/azure/hack_week/restart_container.ps1 b/azure/hack_week/restart_container.ps1 new file mode 100644 index 00000000..2a22776b --- /dev/null +++ b/azure/hack_week/restart_container.ps1 @@ -0,0 +1,17 @@ +param ( + [Parameter()] + [string]$ResourceGroupName, + + [Parameter()] + [string]$ContainerGroupName, + + [Parameter()] + [string]$SubscriptionID, +) + +$azureContext = Connect-AzAccount -Identity + +Get-AzSubscription -SubscriptionId $SubscriptionID | Set-AzContext -Name 'MyContextName' + +echo "Restarting the VM..." +Get-AzContainerGroup -ResourceGroupName $ResourceGroupName -Name $ContainerGroupName | Restart-AzContainerGroup diff --git a/azure/hack_week/setup.sh b/azure/hack_week/setup.sh index 596efd36..8e13ae3b 100755 --- a/azure/hack_week/setup.sh +++ b/azure/hack_week/setup.sh @@ -2,12 +2,11 @@ # Arguments SUBSCRIPTION_NAME=${1:-"Reg Hack Week 2023: Reginald"} -STACK_NAME=${2:-"production"} +STACK_NAME=${2:-"hackweek"} # Fixed values CONTAINER_NAME="pulumi" ENCRYPTION_KEY_NAME="pulumi-encryption-key" -ENCRYPTION_KEY_VERSION="6c74c12825c84362af45973e3e8b38ce" KEYVAULT_NAME=$(echo "kv-reginald-${STACK_NAME}" | head -c 24) LOCATION="uksouth" RESOURCE_GROUP_NAME="rg-reginald-${STACK_NAME}-backend" @@ -37,7 +36,7 @@ if ! (az keyvault show --name "$KEYVAULT_NAME" --resource-group "$RESOURCE_GROUP az keyvault create --location "$LOCATION" --name "$KEYVAULT_NAME" --resource-group "$RESOURCE_GROUP_NAME" --only-show-errors > /dev/null || exit 5 fi echo "✅ Keyvault '$KEYVAULT_NAME'" -if ! (az keyvault key show --name "$ENCRYPTION_KEY_NAME" --vault-name "$KEYVAULT_NAME" --version "$ENCRYPTION_KEY_VERSION" --only-show-errors > /dev/null 2>&1); then +if ! (az keyvault key show --name "$ENCRYPTION_KEY_NAME" --vault-name "$KEYVAULT_NAME" --only-show-errors > /dev/null 2>&1); then az keyvault key create --name "$ENCRYPTION_KEY_NAME" --vault-name "$KEYVAULT_NAME" --only-show-errors > /dev/null || exit 6 fi echo "✅ Encryption key '$ENCRYPTION_KEY_NAME'" @@ -63,10 +62,10 @@ pulumi login "azblob://$CONTAINER_NAME?storage_account=$STORAGE_ACCOUNT_NAME" # Select the correct stack if ! (pulumi stack select "$STACK_NAME" > /dev/null); then echo "Creating new Pulumi stack..." - pulumi stack init "$STACK_NAME" --secrets-provider "azurekeyvault://$KEYVAULT_NAME.vault.azure.net/keys/$ENCRYPTION_KEY_NAME/$ENCRYPTION_KEY_VERSION" + pulumi stack init "$STACK_NAME" --secrets-provider "azurekeyvault://$KEYVAULT_NAME.vault.azure.net/keys/$ENCRYPTION_KEY_NAME" fi echo "✅ Switched to Pulumi stack '$STACK_NAME'" -AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi stack change-secrets-provider "azurekeyvault://$KEYVAULT_NAME.vault.azure.net/keys/$ENCRYPTION_KEY_NAME/$ENCRYPTION_KEY_VERSION" +AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi stack change-secrets-provider "azurekeyvault://$KEYVAULT_NAME.vault.azure.net/keys/$ENCRYPTION_KEY_NAME" echo "✅ Using Azure KeyVault '$KEYVAULT_NAME' for encryption" # Configure the azure-native plugin @@ -76,63 +75,111 @@ AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set azure-native:location "$LOCAT echo "✅ Configured azure-native defaults" # Set app secrets -OPENAI_AZURE_API_BASE="" -OPENAI_AZURE_API_KEY="" -OPENAI_API_KEY="" -HANDBOOK_SLACK_APP_TOKEN="" -HANDBOOK_SLACK_BOT_TOKEN="" -GPT_AZURE_SLACK_APP_TOKEN="" -GPT_AZURE_SLACK_BOT_TOKEN="" -if [ -e ../.pulumi_env ]; then - OPENAI_AZURE_API_BASE=$(grep "OPENAI_AZURE_API_BASE" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) - OPENAI_AZURE_API_KEY=$(grep "OPENAI_AZURE_API_KEY" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) - OPENAI_API_KEY=$(grep "OPENAI_API_KEY" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) - HANDBOOK_SLACK_APP_TOKEN=$(grep "HANDBOOK_SLACK_APP_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) - HANDBOOK_SLACK_BOT_TOKEN=$(grep "HANDBOOK_SLACK_BOT_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) - GPT_AZURE_SLACK_APP_TOKEN=$(grep "GPT_AZURE_SLACK_APP_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) - GPT_AZURE_SLACK_BOT_TOKEN=$(grep "GPT_AZURE_SLACK_BOT_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) -fi - -# ChatCompletionAzure (handbook) tokens -if [ -z "$HANDBOOK_SLACK_APP_TOKEN" ]; then - echo "Please provide a HANDBOOK_SLACK_APP_TOKEN:" - read -r HANDBOOK_SLACK_APP_TOKEN +echo "Setting app secrets..." + +# ChatCompletionAzure tokens +if [ -z "$COMPLETION_SLACK_APP_TOKEN" ]; then + if [ -e ../.pulumi_env ]; then + COMPLETION_SLACK_APP_TOKEN=$(grep "COMPLETION_SLACK_APP_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) + else + echo "Please provide a COMPLETION_SLACK_APP_TOKEN:" + read -r COMPLETION_SLACK_APP_TOKEN + fi +else + echo "✅ COMPLETION_SLACK_APP_TOKEN environment variable found" fi -AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret HANDBOOK_SLACK_APP_TOKEN "$HANDBOOK_SLACK_APP_TOKEN" -if [ -z "$HANDBOOK_SLACK_BOT_TOKEN" ]; then - echo "Please provide a HANDBOOK_SLACK_BOT_TOKEN:" - read -r HANDBOOK_SLACK_BOT_TOKEN +AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret COMPLETION_SLACK_APP_TOKEN "$COMPLETION_SLACK_APP_TOKEN" + +if [ -z "$COMPLETION_SLACK_BOT_TOKEN" ]; then + if [ -e ../.pulumi_env ]; then + COMPLETION_SLACK_BOT_TOKEN=$(grep "COMPLETION_SLACK_BOT_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) + else + echo "Please provide a COMPLETION_SLACK_BOT_TOKEN:" + read -r COMPLETION_SLACK_BOT_TOKEN + fi +else + echo "✅ COMPLETION_SLACK_BOT_TOKEN environment variable found" fi -AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret HANDBOOK_SLACK_BOT_TOKEN "$HANDBOOK_SLACK_BOT_TOKEN" +AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret COMPLETION_SLACK_BOT_TOKEN "$COMPLETION_SLACK_BOT_TOKEN" # LlamaIndexGPTAzure tokens if [ -z "$GPT_AZURE_SLACK_APP_TOKEN" ]; then - echo "Please provide a GPT_AZURE_SLACK_APP_TOKEN:" - read -r GPT_AZURE_SLACK_APP_TOKEN + if [ -e ../.pulumi_env ]; then + GPT_AZURE_SLACK_APP_TOKEN=$(grep "GPT_AZURE_SLACK_APP_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) + else + echo "Please provide a GPT_AZURE_SLACK_APP_TOKEN:" + read -r GPT_AZURE_SLACK_APP_TOKEN + fi +else + echo "✅ GPT_AZURE_SLACK_APP_TOKEN environment variable found" fi AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret GPT_AZURE_SLACK_APP_TOKEN "$GPT_AZURE_SLACK_APP_TOKEN" + if [ -z "$GPT_AZURE_SLACK_BOT_TOKEN" ]; then - echo "Please provide a GPT_AZURE_SLACK_BOT_TOKEN:" - read -r GPT_AZURE_SLACK_BOT_TOKEN + if [ -e ../.pulumi_env ]; then + GPT_AZURE_SLACK_BOT_TOKEN=$(grep "GPT_AZURE_SLACK_BOT_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) + else + echo "Please provide a GPT_AZURE_SLACK_BOT_TOKEN:" + read -r GPT_AZURE_SLACK_BOT_TOKEN + fi +else + echo "✅ GPT_AZURE_SLACK_BOT_TOKEN environment variable found" fi AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret GPT_AZURE_SLACK_BOT_TOKEN "$GPT_AZURE_SLACK_BOT_TOKEN" # The ChatCompletionAzure and LlamaIndexGPTAzure models need an Azure backend if [ -z "$OPENAI_AZURE_API_BASE" ]; then - echo "Please provide a OPENAI_AZURE_API_BASE:" - read -r OPENAI_AZURE_API_BASE + if [ -e ../.pulumi_env ]; then + OPENAI_AZURE_API_BASE=$(grep "OPENAI_AZURE_API_BASE" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) + else + echo "Please provide a OPENAI_AZURE_API_BASE:" + read -r OPENAI_AZURE_API_BASE + fi +else + echo "✅ OPENAI_AZURE_API_BASE environment variable found" fi AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set OPENAI_AZURE_API_BASE "$OPENAI_AZURE_API_BASE" + if [ -z "$OPENAI_AZURE_API_KEY" ]; then - echo "Please provide a OPENAI_AZURE_API_KEY:" - read -r OPENAI_AZURE_API_KEY + if [ -e ../.pulumi_env ]; then + OPENAI_AZURE_API_KEY=$(grep "OPENAI_AZURE_API_KEY" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) + else + echo "Please provide a OPENAI_AZURE_API_KEY:" + read -r OPENAI_AZURE_API_KEY + fi +else + echo "✅ OPENAI_AZURE_API_KEY environment variable found" fi AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret OPENAI_AZURE_API_KEY "$OPENAI_AZURE_API_KEY" +# GitHub token +if [ -z "$GITHUB_TOKEN" ]; then + if [ -e ../.pulumi_env ]; then + GITHUB_TOKEN=$(grep "GITHUB_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) + else + echo "Please provide a GITHUB_TOKEN:" + read -r GITHUB_TOKEN + fi +else + echo "✅ GITHUB_TOKEN environment variable found" +fi +AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret GITHUB_TOKEN "$GITHUB_TOKEN" + # The ChatCompletionOpenAI and LlamaIndexGPTOpenAI models need an OpenAI key (not used currently) # if [ -z "$OPENAI_API_KEY" ]; then # echo "Please provide a OPENAI_API_KEY:" # read -r OPENAI_API_KEY +# else +# echo "✅ OPENAI_API_KEY environment variable found in .pulumi_env" # fi -# AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret OPENAI_API_KEY "$OPENAI_API_KEY" + +if [ -z "$OPENAI_API_KEY" ] && [ -e ../.pulumi_env ]; then + OPENAI_API_KEY=$(grep "OPENAI_API_KEY" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) +fi + +if [ -z "$OPENAI_API_KEY" ]; then + echo "❎ OPENAI_API_KEY environment variable not found (but not required)" +else + echo "✅ OPENAI_API_KEY environment variable found" +fi AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret OPENAI_API_KEY "$OPENAI_API_KEY" diff --git a/azure/production/Pulumi.yaml b/azure/production/Pulumi.yaml new file mode 100644 index 00000000..2c7b14de --- /dev/null +++ b/azure/production/Pulumi.yaml @@ -0,0 +1,4 @@ +name: reginald +runtime: + name: python +description: Slack bot to respond to REG queries which sends a the queries to an API. diff --git a/azure/production/__main__.py b/azure/production/__main__.py new file mode 100644 index 00000000..9d7945cf --- /dev/null +++ b/azure/production/__main__.py @@ -0,0 +1,215 @@ +import pulumi +from pulumi_azure_native import ( + automation, + containerinstance, + network, + resources, + storage, +) + +# Get some configuration variables +stack_name = pulumi.get_stack() +config = pulumi.Config() + + +# Create an resource group +resource_group = resources.ResourceGroup( + "resource_group", resource_group_name=f"rg-reginald-{stack_name}-deployment" +) + +# Create an automation account +automation_account = automation.AutomationAccount( + "automation_account", + automation_account_name=f"aa-reginald-{stack_name}", + resource_group_name=resource_group.name, + sku=automation.SkuArgs( + name="Free", + ), +) + +# Create a network security group +network_security_group = network.NetworkSecurityGroup( + "network_security_group", + network_security_group_name=f"nsg-reginald-{stack_name}-containers", + resource_group_name=resource_group.name, +) + +# Create a virtual network and subnet +virtual_network = network.VirtualNetwork( + "virtual_network", + address_space=network.AddressSpaceArgs( + address_prefixes=["10.0.0.0/29"], + ), + resource_group_name=resource_group.name, + # Define subnets inline to avoid creation/deletion issues + subnets=[ + # Container subnet + network.SubnetArgs( + address_prefix="10.0.0.0/29", + delegations=[ + network.DelegationArgs( + name="SubnetDelegationContainerGroups", + service_name="Microsoft.ContainerInstance/containerGroups", + type="Microsoft.Network/virtualNetworks/subnets/delegations", + ), + ], + name="ContainersSubnet", + network_security_group=network.NetworkSecurityGroupArgs( + id=network_security_group.id + ), + ), + ], + virtual_network_name=f"vnet-reginald-{stack_name}", + virtual_network_peerings=[], +) + +# Define configuration file shares +storage_account = storage.StorageAccount( + "storage_account", + account_name=f"sareginald{stack_name}configuration"[:24], + kind=storage.Kind.STORAGE_V2, + resource_group_name=resource_group.name, + sku=storage.SkuArgs(name=storage.SkuName.STANDARD_GRS), +) +file_share = storage.FileShare( + "data_file_share", + access_tier=storage.ShareAccessTier.TRANSACTION_OPTIMIZED, + account_name=storage_account.name, + resource_group_name=resource_group.name, + share_name="llama-data", + share_quota=5120, +) +storage_account_keys = pulumi.Output.all( + storage_account.name, resource_group.name +).apply( + lambda args: storage.list_storage_account_keys( + account_name=args[0], + resource_group_name=args[1], + opts=pulumi.InvokeOptions(parent=storage_account), + ) +) +storage_account_key = storage_account_keys.apply( + lambda keys: pulumi.Output.secret(keys.keys[0].value) +) + +# Define the container group +container_group = containerinstance.ContainerGroup( + "container_group-bot", + container_group_name=f"aci-reginald-{stack_name}-bot", + containers=[ + # api-bot container + containerinstance.ContainerArgs( + image="ghcr.io/alan-turing-institute/reginald_slackbot:main", + name="reginald-production", # maximum of 63 characters + environment_variables=[ + containerinstance.EnvironmentVariableArgs( + name="REGINALD_MODEL", + value="llama-index-llama-cpp", + ), + containerinstance.EnvironmentVariableArgs( + name="SLACK_APP_TOKEN", + secure_value=config.get_secret("REGINALD_SLACK_APP_TOKEN"), + ), + containerinstance.EnvironmentVariableArgs( + name="SLACK_BOT_TOKEN", + secure_value=config.get_secret("REGINALD_SLACK_BOT_TOKEN"), + ), + containerinstance.EnvironmentVariableArgs( + name="REGINALD_API_URL", + secure_value=config.get_secret("REGINALD_API_URL"), + ), + ], + ports=[], + resources=containerinstance.ResourceRequirementsArgs( + requests=containerinstance.ResourceRequestsArgs( + cpu=1, + memory_in_gb=4, + ), + ), + ), + ], + os_type=containerinstance.OperatingSystemTypes.LINUX, + resource_group_name=resource_group.name, + restart_policy=containerinstance.ContainerGroupRestartPolicy.ALWAYS, + sku=containerinstance.ContainerGroupSku.STANDARD, + volumes=[ + containerinstance.VolumeArgs( + azure_file=containerinstance.AzureFileVolumeArgs( + share_name=file_share.name, + storage_account_key=storage_account_key, + storage_account_name=storage_account.name, + ), + name="llama-data", + ), + ], +) + +# Define the container group for the data creation +container_group = containerinstance.ContainerGroup( + "container_group-data", + container_group_name=f"aci-reginald-{stack_name}-data", + containers=[ + # all_data index creation container + containerinstance.ContainerArgs( + image="ghcr.io/alan-turing-institute/reginald_create_index:main", + name="reginald-create-index", # maximum of 63 characters + environment_variables=[ + containerinstance.EnvironmentVariableArgs( + name="GITHUB_TOKEN", + secure_value=config.get_secret("GITHUB_TOKEN"), + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_WHICH_INDEX", + value="all_data", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_MAX_INPUT_SIZE", + value="4096", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_K", + value="3", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_CHUNK_SIZE", + value="512", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_CHUNK_OVERLAP_RATIO", + value="0.1", + ), + containerinstance.EnvironmentVariableArgs( + name="LLAMA_INDEX_NUM_OUTPUT", + value="512", + ), + ], + ports=[], + resources=containerinstance.ResourceRequirementsArgs( + requests=containerinstance.ResourceRequestsArgs( + cpu=4, + memory_in_gb=16, + ), + ), + volume_mounts=[ + containerinstance.VolumeMountArgs( + mount_path="/app/data", + name="llama-data", + ), + ], + ), + ], + os_type=containerinstance.OperatingSystemTypes.LINUX, + resource_group_name=resource_group.name, + restart_policy=containerinstance.ContainerGroupRestartPolicy.NEVER, + sku=containerinstance.ContainerGroupSku.STANDARD, + volumes=[ + containerinstance.VolumeArgs( + azure_file=containerinstance.AzureFileVolumeArgs( + share_name=file_share.name, + storage_account_key=storage_account_key, + storage_account_name=storage_account.name, + ), + name="llama-data", + ), + ], +) diff --git a/azure/api_bot/setup.sh b/azure/production/setup.sh similarity index 53% rename from azure/api_bot/setup.sh rename to azure/production/setup.sh index 0d5bd903..5bb60f73 100755 --- a/azure/api_bot/setup.sh +++ b/azure/production/setup.sh @@ -2,7 +2,7 @@ # Arguments SUBSCRIPTION_NAME=${1:-"Reg Hack Week 2023: Reginald"} -STACK_NAME=${2:-"llama-cpp-api"} +STACK_NAME=${2:-"production"} # Fixed values CONTAINER_NAME="pulumi" @@ -10,6 +10,7 @@ ENCRYPTION_KEY_NAME="pulumi-encryption-key" KEYVAULT_NAME=$(echo "kv-reginald-${STACK_NAME}" | head -c 24) LOCATION="uksouth" RESOURCE_GROUP_NAME="rg-reginald-${STACK_NAME}-backend" +STORAGE_ACCOUNT_NAME=$(echo "sareginald${STACK_NAME}backend$(echo "$SUBSCRIPTION_NAME" | md5sum)" | head -c 24) # Ensure that the user is logged in if ! (az account show > /dev/null); then @@ -24,6 +25,12 @@ az account set --subscription "$SUBSCRIPTION_NAME" --only-show-errors > /dev/nul az group create --location "$LOCATION" --name "$RESOURCE_GROUP_NAME" --only-show-errors > /dev/null || exit 2 echo "✅ Resource group '$RESOURCE_GROUP_NAME'" +# Create storage account and container +az storage account create --name "$STORAGE_ACCOUNT_NAME" --resource-group "$RESOURCE_GROUP_NAME" --allow-blob-public-access --only-show-errors > /dev/null || exit 3 +echo "✅ Storage account '$STORAGE_ACCOUNT_NAME'" +az storage container create --name "$CONTAINER_NAME" --account-name "$STORAGE_ACCOUNT_NAME" --only-show-errors > /dev/null || exit 4 +echo "✅ Storage container '$CONTAINER_NAME'" + # Create keyvault and encryption key if ! (az keyvault show --name "$KEYVAULT_NAME" --resource-group "$RESOURCE_GROUP_NAME" --only-show-errors > /dev/null 2>&1); then az keyvault create --location "$LOCATION" --name "$KEYVAULT_NAME" --resource-group "$RESOURCE_GROUP_NAME" --only-show-errors > /dev/null || exit 5 @@ -46,6 +53,12 @@ fi az keyvault set-policy --name "$KEYVAULT_NAME" --object-id "$USER_ID" --secret-permissions "all" --key-permissions "all" --certificate-permissions "all" --only-show-errors > /dev/null || exit 7 echo "✅ User has read permissions on '$KEYVAULT_NAME'" +# Log in with Pulumi +echo "Logging in with Pulumi..." +echo "AZURE_STORAGE_KEY=$(az storage account keys list --account-name "$STORAGE_ACCOUNT_NAME" --resource-group "$RESOURCE_GROUP_NAME" --output tsv --query '[0].value')" > .secrets +source .secrets +pulumi login "azblob://$CONTAINER_NAME?storage_account=$STORAGE_ACCOUNT_NAME" + # Select the correct stack if ! (pulumi stack select "$STACK_NAME" > /dev/null); then echo "Creating new Pulumi stack..." @@ -62,18 +75,55 @@ AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set azure-native:location "$LOCAT echo "✅ Configured azure-native defaults" # Set app secrets -LLAMA_CPP_SLACK_APP_TOKEN="" -LLAMA_CPP_SLACK_BOT_TOKEN="" -if [ -e ../.pulumi_env ]; then - LLAMA_CPP_SLACK_APP_TOKEN=$(grep "LLAMA_CPP_SLACK_APP_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) - LLAMA_CPP_SLACK_BOT_TOKEN=$(grep "LLAMA_CPP_SLACK_BOT_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) +echo "Setting app secrets..." + +# Slack tokens +if [ -z "$REGINALD_SLACK_APP_TOKEN" ]; then + if [ -e ../.pulumi_env ]; then + REGINALD_SLACK_APP_TOKEN=$(grep "REGINALD_SLACK_APP_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) + else + echo "Please provide a REGINALD_SLACK_APP_TOKEN:" + read -r REGINALD_SLACK_APP_TOKEN + fi +else + echo "✅ REGINALD_SLACK_APP_TOKEN environment variable found" fi -AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret LLAMA_CPP_SLACK_APP_TOKEN "$LLAMA_CPP_SLACK_APP_TOKEN" -AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret LLAMA_CPP_SLACK_BOT_TOKEN "$LLAMA_CPP_SLACK_BOT_TOKEN" +AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret REGINALD_SLACK_APP_TOKEN "$REGINALD_SLACK_APP_TOKEN" -# Set API url -REGINALD_API_URL="" -if [ -e ../.pulumi_env ]; then - REGINALD_API_URL=$(grep "REGINALD_API_URL" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) +if [ -z "$REGINALD_SLACK_BOT_TOKEN" ]; then + if [ -e ../pulumi_env ]; then + REGINALD_SLACK_BOT_TOKEN=$(grep "REGINALD_SLACK_BOT_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) + else + echo "Please provide a REGINALD_SLACK_BOT_TOKEN:" + read -r REGINALD_SLACK_BOT_TOKEN + fi +else + echo "✅ REGINALD_SLACK_BOT_TOKEN environment variable found" +fi +AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret REGINALD_SLACK_BOT_TOKEN "$REGINALD_SLACK_BOT_TOKEN" + +# API URL +if [ -z "$REGINALD_API_URL" ]; then + if [ -e ../.pulumi_env ]; then + REGINALD_API_URL=$(grep "REGINALD_API_URL" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) + else + echo "Please provide a REGINALD_API_URL:" + read -r REGINALD_API_URL + fi +else + echo "✅ REGINALD_API_URL environment variable found" +fi +AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret REGINALD_API_URL "$REGINALD_API_URL" + +# GitHub token +if [ -z "$GITHUB_TOKEN" ]; then + if [ -e ../.pulumi_env ]; then + GITHUB_TOKEN=$(grep "GITHUB_TOKEN" ../.pulumi_env | grep -v "^#" | cut -d '"' -f 2) + else + echo "Please provide a GITHUB_TOKEN:" + read -r GITHUB_TOKEN + fi +else + echo "✅ GITHUB_TOKEN environment variable found" fi -AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set REGINALD_API_URL "$REGINALD_API_URL" +AZURE_KEYVAULT_AUTH_VIA_CLI=true pulumi config set --secret GITHUB_TOKEN "$GITHUB_TOKEN" diff --git a/azure/production/switch_vm_on_off.ps1 b/azure/production/switch_vm_on_off.ps1 new file mode 100644 index 00000000..04a28464 --- /dev/null +++ b/azure/production/switch_vm_on_off.ps1 @@ -0,0 +1,29 @@ +param ( + [Parameter()] + [string]$ResourceGroupName, + + [Parameter()] + [string]$VMName, + + [Parameter()] + [string]$SubscriptionID, + + [Parameter()] + [string]$Action +) + +$azureContext = Connect-AzAccount -Identity + +Get-AzSubscription -SubscriptionId $SubscriptionID | Set-AzContext -Name 'MyContextName' + +$VM = Get-AzVM -ResourceGroupName $ResourceGroupName -Name $VMName + +if ($Action -eq "Start") { + echo "Starting the VM..." + Start-AzVM -ResourceGroupName $ResourceGroupName -Name $VMName +} elseif ($Action -eq "Stop") { + echo "Turning off the VM..." + Stop-AzVM -ResourceGroupName $ResourceGroupName -Name $VMName -Force +} else { + Write-Error "Invalid action. Use 'Start' or 'Stop'." +} diff --git a/poetry.lock b/poetry.lock index 20738d4f..5e04c1bd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -150,20 +150,6 @@ files = [ [package.dependencies] frozenlist = ">=1.1.0" -[[package]] -name = "aiostream" -version = "0.5.2" -description = "Generator-based operators for asynchronous iteration" -optional = false -python-versions = ">=3.8" -files = [ - {file = "aiostream-0.5.2-py3-none-any.whl", hash = "sha256:054660370be9d37f6fe3ece3851009240416bd082e469fd90cc8673d3818cf71"}, - {file = "aiostream-0.5.2.tar.gz", hash = "sha256:b71b519a2d66c38f0872403ab86417955b77352f08d9ad02ad46fc3926b389f4"}, -] - -[package.dependencies] -typing-extensions = "*" - [[package]] name = "altair" version = "5.1.1" @@ -261,27 +247,6 @@ six = ">=1.12.0" [package.extras] test = ["astroid", "pytest"] -[[package]] -name = "atlassian-python-api" -version = "3.41.2" -description = "Python Atlassian REST API Wrapper" -optional = false -python-versions = "*" -files = [ - {file = "atlassian-python-api-3.41.2.tar.gz", hash = "sha256:a2022977da5a395412ace8e29c2c541312f07d45fc750435dec036af53daceda"}, - {file = "atlassian_python_api-3.41.2-py3-none-any.whl", hash = "sha256:27c2361a22ee8cc69988f67a591488cbfce09e5f284da000011af11944d2bc96"}, -] - -[package.dependencies] -deprecated = "*" -oauthlib = "*" -requests = "*" -requests-oauthlib = "*" -six = "*" - -[package.extras] -kerberos = ["requests-kerberos"] - [[package]] name = "attrs" version = "23.1.0" @@ -315,7 +280,7 @@ files = [ name = "beautifulsoup4" version = "4.12.2" description = "Screen-scraping library" -optional = true +optional = false python-versions = ">=3.6.0" files = [ {file = "beautifulsoup4-4.12.2-py3-none-any.whl", hash = "sha256:bd2520ca0d9d7d12694a53d44ac482d181b4ec1888909b035a3dbf40d0f57d4a"}, @@ -875,6 +840,17 @@ files = [ {file = "distlib-0.3.7.tar.gz", hash = "sha256:9dafe54b34a028eafd95039d5e5d4851a13734540f1331060d31c9916e7147a8"}, ] +[[package]] +name = "distro" +version = "1.9.0" +description = "Distro - an OS platform information API" +optional = false +python-versions = ">=3.6" +files = [ + {file = "distro-1.9.0-py3-none-any.whl", hash = "sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2"}, + {file = "distro-1.9.0.tar.gz", hash = "sha256:2fa77c6fd8940f116ee1d6b94a2f90b13b5ea8d019b98bc8bafdcabcdd9bdbed"}, +] + [[package]] name = "executing" version = "1.2.0" @@ -1165,20 +1141,20 @@ smmap = ">=3.0.1,<6" [[package]] name = "gitpython" -version = "3.1.37" +version = "3.1.41" description = "GitPython is a Python library used to interact with Git repositories" optional = false python-versions = ">=3.7" files = [ - {file = "GitPython-3.1.37-py3-none-any.whl", hash = "sha256:5f4c4187de49616d710a77e98ddf17b4782060a1788df441846bddefbb89ab33"}, - {file = "GitPython-3.1.37.tar.gz", hash = "sha256:f9b9ddc0761c125d5780eab2d64be4873fc6817c2899cbcb34b02344bdc7bc54"}, + {file = "GitPython-3.1.41-py3-none-any.whl", hash = "sha256:c36b6634d069b3f719610175020a9aed919421c87552185b085e04fbbdb10b7c"}, + {file = "GitPython-3.1.41.tar.gz", hash = "sha256:ed66e624884f76df22c8e16066d567aaa5a37d5b5fa19db2c6df6f7156db9048"}, ] [package.dependencies] gitdb = ">=4.0.1,<5" [package.extras] -test = ["black", "coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mypy", "pre-commit", "pytest", "pytest-cov", "pytest-sugar"] +test = ["black", "coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mock", "mypy", "pre-commit", "pytest (>=7.3.1)", "pytest-cov", "pytest-instafail", "pytest-mock", "pytest-sugar", "sumtypes"] [[package]] name = "gradio" @@ -1876,21 +1852,22 @@ files = [ [[package]] name = "langchain" -version = "0.0.329" +version = "0.0.354" description = "Building applications with LLMs through composability" optional = false python-versions = ">=3.8.1,<4.0" files = [ - {file = "langchain-0.0.329-py3-none-any.whl", hash = "sha256:5f3e884991271e8b55eda4c63a11105dcd7da119682ce0e3d5d1385b3a4103d2"}, - {file = "langchain-0.0.329.tar.gz", hash = "sha256:488f3cb68a587696f136d4f01f97df8d8270e295b3cc56158057dab0f61f4166"}, + {file = "langchain-0.0.354-py3-none-any.whl", hash = "sha256:8d28283a2891422a685b0605dd23b5a1cd6a15ab57a8e359b37a3151a322bad4"}, + {file = "langchain-0.0.354.tar.gz", hash = "sha256:419c48735b803d70c0dee985e0afcfd7c88528b8c1cd918c57eb23e53d94ea87"}, ] [package.dependencies] aiohttp = ">=3.8.3,<4.0.0" -anyio = "<4.0" dataclasses-json = ">=0.5.7,<0.7" jsonpatch = ">=1.33,<2.0" -langsmith = ">=0.0.52,<0.1.0" +langchain-community = ">=0.0.8,<0.1" +langchain-core = ">=0.1.5,<0.2" +langsmith = ">=0.0.77,<0.1.0" numpy = ">=1,<2" pydantic = ">=1,<3" PyYAML = ">=5.3" @@ -1899,29 +1876,78 @@ SQLAlchemy = ">=1.4,<3" tenacity = ">=8.1.0,<9.0.0" [package.extras] -all = ["O365 (>=2.0.26,<3.0.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "amadeus (>=8.1.0)", "arxiv (>=1.4,<2.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "awadb (>=0.3.9,<0.4.0)", "azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "beautifulsoup4 (>=4,<5)", "clarifai (>=9.1.0)", "clickhouse-connect (>=0.5.14,<0.6.0)", "cohere (>=4,<5)", "deeplake (>=3.8.3,<4.0.0)", "docarray[hnswlib] (>=0.32.0,<0.33.0)", "duckduckgo-search (>=3.8.3,<4.0.0)", "elasticsearch (>=8,<9)", "esprima (>=4.0.1,<5.0.0)", "faiss-cpu (>=1,<2)", "google-api-python-client (==2.70.0)", "google-auth (>=2.18.1,<3.0.0)", "google-search-results (>=2,<3)", "gptcache (>=0.1.7)", "html2text (>=2020.1.16,<2021.0.0)", "huggingface_hub (>=0,<1)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "lancedb (>=0.1,<0.2)", "langkit (>=0.0.6,<0.1.0)", "lark (>=1.1.5,<2.0.0)", "librosa (>=0.10.0.post2,<0.11.0)", "lxml (>=4.9.2,<5.0.0)", "manifest-ml (>=0.0.1,<0.0.2)", "marqo (>=1.2.4,<2.0.0)", "momento (>=1.10.1,<2.0.0)", "nebula3-python (>=3.4.0,<4.0.0)", "neo4j (>=5.8.1,<6.0.0)", "networkx (>=2.6.3,<4)", "nlpcloud (>=1,<2)", "nltk (>=3,<4)", "nomic (>=1.0.43,<2.0.0)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "opensearch-py (>=2.0.0,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pexpect (>=4.8.0,<5.0.0)", "pgvector (>=0.1.6,<0.2.0)", "pinecone-client (>=2,<3)", "pinecone-text (>=0.4.2,<0.5.0)", "psycopg2-binary (>=2.9.5,<3.0.0)", "pymongo (>=4.3.3,<5.0.0)", "pyowm (>=3.3.0,<4.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pytesseract (>=0.3.10,<0.4.0)", "python-arango (>=7.5.9,<8.0.0)", "pyvespa (>=0.33.0,<0.34.0)", "qdrant-client (>=1.3.1,<2.0.0)", "rdflib (>=6.3.2,<7.0.0)", "redis (>=4,<5)", "requests-toolbelt (>=1.0.0,<2.0.0)", "sentence-transformers (>=2,<3)", "singlestoredb (>=0.7.1,<0.8.0)", "tensorflow-text (>=2.11.0,<3.0.0)", "tigrisdb (>=1.0.0b6,<2.0.0)", "tiktoken (>=0.3.2,<0.6.0)", "torch (>=1,<3)", "transformers (>=4,<5)", "weaviate-client (>=3,<4)", "wikipedia (>=1,<2)", "wolframalpha (==5.0.0)"] -azure = ["azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-core (>=1.26.4,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "azure-search-documents (==11.4.0b8)", "openai (>=0,<1)"] +azure = ["azure-ai-formrecognizer (>=3.2.1,<4.0.0)", "azure-ai-textanalytics (>=5.3.0,<6.0.0)", "azure-ai-vision (>=0.11.1b1,<0.12.0)", "azure-cognitiveservices-speech (>=1.28.0,<2.0.0)", "azure-core (>=1.26.4,<2.0.0)", "azure-cosmos (>=4.4.0b1,<5.0.0)", "azure-identity (>=1.12.0,<2.0.0)", "azure-search-documents (==11.4.0b8)", "openai (<2)"] clarifai = ["clarifai (>=9.1.0)"] cli = ["typer (>=0.9.0,<0.10.0)"] cohere = ["cohere (>=4,<5)"] docarray = ["docarray[hnswlib] (>=0.32.0,<0.33.0)"] embeddings = ["sentence-transformers (>=2,<3)"] -extended-testing = ["aiosqlite (>=0.19.0,<0.20.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "anthropic (>=0.3.11,<0.4.0)", "arxiv (>=1.4,<2.0)", "assemblyai (>=0.17.0,<0.18.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "beautifulsoup4 (>=4,<5)", "bibtexparser (>=1.4.0,<2.0.0)", "cassio (>=0.1.0,<0.2.0)", "chardet (>=5.1.0,<6.0.0)", "dashvector (>=1.0.1,<2.0.0)", "esprima (>=4.0.1,<5.0.0)", "faiss-cpu (>=1,<2)", "feedparser (>=6.0.10,<7.0.0)", "fireworks-ai (>=0.6.0,<0.7.0)", "geopandas (>=0.13.1,<0.14.0)", "gitpython (>=3.1.32,<4.0.0)", "google-cloud-documentai (>=2.20.1,<3.0.0)", "gql (>=3.4.1,<4.0.0)", "html2text (>=2020.1.16,<2021.0.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "jsonschema (>1)", "lxml (>=4.9.2,<5.0.0)", "markdownify (>=0.11.6,<0.12.0)", "motor (>=3.3.1,<4.0.0)", "mwparserfromhell (>=0.6.4,<0.7.0)", "mwxml (>=0.3.3,<0.4.0)", "newspaper3k (>=0.2.8,<0.3.0)", "numexpr (>=2.8.6,<3.0.0)", "openai (>=0,<1)", "openapi-pydantic (>=0.3.2,<0.4.0)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pgvector (>=0.1.6,<0.2.0)", "psychicapi (>=0.8.0,<0.9.0)", "py-trello (>=0.19.0,<0.20.0)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "pyspark (>=3.4.0,<4.0.0)", "rank-bm25 (>=0.2.2,<0.3.0)", "rapidfuzz (>=3.1.1,<4.0.0)", "rapidocr-onnxruntime (>=1.3.2,<2.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "rspace_client (>=2.5.0,<3.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "sqlite-vss (>=0.1.2,<0.2.0)", "streamlit (>=1.18.0,<2.0.0)", "sympy (>=1.12,<2.0)", "telethon (>=1.28.5,<2.0.0)", "timescale-vector (>=0.0.1,<0.0.2)", "tqdm (>=4.48.0)", "upstash-redis (>=0.15.0,<0.16.0)", "xata (>=1.0.0a7,<2.0.0)", "xmltodict (>=0.13.0,<0.14.0)"] +extended-testing = ["aiosqlite (>=0.19.0,<0.20.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "anthropic (>=0.3.11,<0.4.0)", "arxiv (>=1.4,<2.0)", "assemblyai (>=0.17.0,<0.18.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "beautifulsoup4 (>=4,<5)", "bibtexparser (>=1.4.0,<2.0.0)", "cassio (>=0.1.0,<0.2.0)", "chardet (>=5.1.0,<6.0.0)", "cohere (>=4,<5)", "couchbase (>=4.1.9,<5.0.0)", "dashvector (>=1.0.1,<2.0.0)", "databricks-vectorsearch (>=0.21,<0.22)", "datasets (>=2.15.0,<3.0.0)", "dgml-utils (>=0.3.0,<0.4.0)", "esprima (>=4.0.1,<5.0.0)", "faiss-cpu (>=1,<2)", "feedparser (>=6.0.10,<7.0.0)", "fireworks-ai (>=0.9.0,<0.10.0)", "geopandas (>=0.13.1,<0.14.0)", "gitpython (>=3.1.32,<4.0.0)", "google-cloud-documentai (>=2.20.1,<3.0.0)", "gql (>=3.4.1,<4.0.0)", "hologres-vector (>=0.0.6,<0.0.7)", "html2text (>=2020.1.16,<2021.0.0)", "javelin-sdk (>=0.1.8,<0.2.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "jsonschema (>1)", "lxml (>=4.9.2,<5.0.0)", "markdownify (>=0.11.6,<0.12.0)", "motor (>=3.3.1,<4.0.0)", "msal (>=1.25.0,<2.0.0)", "mwparserfromhell (>=0.6.4,<0.7.0)", "mwxml (>=0.3.3,<0.4.0)", "newspaper3k (>=0.2.8,<0.3.0)", "numexpr (>=2.8.6,<3.0.0)", "openai (<2)", "openapi-pydantic (>=0.3.2,<0.4.0)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pgvector (>=0.1.6,<0.2.0)", "praw (>=7.7.1,<8.0.0)", "psychicapi (>=0.8.0,<0.9.0)", "py-trello (>=0.19.0,<0.20.0)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "pyspark (>=3.4.0,<4.0.0)", "rank-bm25 (>=0.2.2,<0.3.0)", "rapidfuzz (>=3.1.1,<4.0.0)", "rapidocr-onnxruntime (>=1.3.2,<2.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "rspace_client (>=2.5.0,<3.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "sqlite-vss (>=0.1.2,<0.2.0)", "streamlit (>=1.18.0,<2.0.0)", "sympy (>=1.12,<2.0)", "telethon (>=1.28.5,<2.0.0)", "timescale-vector (>=0.0.1,<0.0.2)", "tqdm (>=4.48.0)", "upstash-redis (>=0.15.0,<0.16.0)", "xata (>=1.0.0a7,<2.0.0)", "xmltodict (>=0.13.0,<0.14.0)"] javascript = ["esprima (>=4.0.1,<5.0.0)"] -llms = ["clarifai (>=9.1.0)", "cohere (>=4,<5)", "huggingface_hub (>=0,<1)", "manifest-ml (>=0.0.1,<0.0.2)", "nlpcloud (>=1,<2)", "openai (>=0,<1)", "openlm (>=0.0.5,<0.0.6)", "torch (>=1,<3)", "transformers (>=4,<5)"] -openai = ["openai (>=0,<1)", "tiktoken (>=0.3.2,<0.6.0)"] +llms = ["clarifai (>=9.1.0)", "cohere (>=4,<5)", "huggingface_hub (>=0,<1)", "manifest-ml (>=0.0.1,<0.0.2)", "nlpcloud (>=1,<2)", "openai (<2)", "openlm (>=0.0.5,<0.0.6)", "torch (>=1,<3)", "transformers (>=4,<5)"] +openai = ["openai (<2)", "tiktoken (>=0.3.2,<0.6.0)"] qdrant = ["qdrant-client (>=1.3.1,<2.0.0)"] text-helpers = ["chardet (>=5.1.0,<6.0.0)"] +[[package]] +name = "langchain-community" +version = "0.0.8" +description = "Community contributed LangChain integrations." +optional = false +python-versions = ">=3.8.1,<4.0" +files = [ + {file = "langchain_community-0.0.8-py3-none-any.whl", hash = "sha256:cf8ac1c5dcf886e9c0e20842a8774e7753e9f87c83f0734f50c54cc3cc513eea"}, + {file = "langchain_community-0.0.8.tar.gz", hash = "sha256:d11207f9be3020a82f46927f47f5a75b29ed3ad29240bd3e8b7e862c41d69274"}, +] + +[package.dependencies] +aiohttp = ">=3.8.3,<4.0.0" +dataclasses-json = ">=0.5.7,<0.7" +langchain-core = ">=0.1.5,<0.2" +langsmith = ">=0.0.63,<0.1.0" +numpy = ">=1,<2" +PyYAML = ">=5.3" +requests = ">=2,<3" +SQLAlchemy = ">=1.4,<3" +tenacity = ">=8.1.0,<9.0.0" + +[package.extras] +cli = ["typer (>=0.9.0,<0.10.0)"] +extended-testing = ["aiosqlite (>=0.19.0,<0.20.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "anthropic (>=0.3.11,<0.4.0)", "arxiv (>=1.4,<2.0)", "assemblyai (>=0.17.0,<0.18.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "azure-ai-documentintelligence (>=1.0.0b1,<2.0.0)", "beautifulsoup4 (>=4,<5)", "bibtexparser (>=1.4.0,<2.0.0)", "cassio (>=0.1.0,<0.2.0)", "chardet (>=5.1.0,<6.0.0)", "cohere (>=4,<5)", "dashvector (>=1.0.1,<2.0.0)", "databricks-vectorsearch (>=0.21,<0.22)", "datasets (>=2.15.0,<3.0.0)", "dgml-utils (>=0.3.0,<0.4.0)", "esprima (>=4.0.1,<5.0.0)", "faiss-cpu (>=1,<2)", "feedparser (>=6.0.10,<7.0.0)", "fireworks-ai (>=0.9.0,<0.10.0)", "geopandas (>=0.13.1,<0.14.0)", "gitpython (>=3.1.32,<4.0.0)", "google-cloud-documentai (>=2.20.1,<3.0.0)", "gql (>=3.4.1,<4.0.0)", "gradientai (>=1.4.0,<2.0.0)", "hologres-vector (>=0.0.6,<0.0.7)", "html2text (>=2020.1.16,<2021.0.0)", "javelin-sdk (>=0.1.8,<0.2.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "jsonschema (>1)", "lxml (>=4.9.2,<5.0.0)", "markdownify (>=0.11.6,<0.12.0)", "motor (>=3.3.1,<4.0.0)", "msal (>=1.25.0,<2.0.0)", "mwparserfromhell (>=0.6.4,<0.7.0)", "mwxml (>=0.3.3,<0.4.0)", "newspaper3k (>=0.2.8,<0.3.0)", "numexpr (>=2.8.6,<3.0.0)", "openai (<2)", "openapi-pydantic (>=0.3.2,<0.4.0)", "oracle-ads (>=2.9.1,<3.0.0)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pgvector (>=0.1.6,<0.2.0)", "praw (>=7.7.1,<8.0.0)", "psychicapi (>=0.8.0,<0.9.0)", "py-trello (>=0.19.0,<0.20.0)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "pyspark (>=3.4.0,<4.0.0)", "rank-bm25 (>=0.2.2,<0.3.0)", "rapidfuzz (>=3.1.1,<4.0.0)", "rapidocr-onnxruntime (>=1.3.2,<2.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "rspace_client (>=2.5.0,<3.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "sqlite-vss (>=0.1.2,<0.2.0)", "streamlit (>=1.18.0,<2.0.0)", "sympy (>=1.12,<2.0)", "telethon (>=1.28.5,<2.0.0)", "timescale-vector (>=0.0.1,<0.0.2)", "tqdm (>=4.48.0)", "upstash-redis (>=0.15.0,<0.16.0)", "xata (>=1.0.0a7,<2.0.0)", "xmltodict (>=0.13.0,<0.14.0)", "zhipuai (>=1.0.7,<2.0.0)"] + +[[package]] +name = "langchain-core" +version = "0.1.6" +description = "Building applications with LLMs through composability" +optional = false +python-versions = ">=3.8.1,<4.0" +files = [ + {file = "langchain_core-0.1.6-py3-none-any.whl", hash = "sha256:1c3e6ba5f6cc70c0934fea99a80a8312e73612ccb727ff8950d8013ea7cd07f6"}, + {file = "langchain_core-0.1.6.tar.gz", hash = "sha256:cacb5972a05632f6dbea0785eb11323121295bcbf682b53a53c9afcb902f3954"}, +] + +[package.dependencies] +anyio = ">=3,<5" +jsonpatch = ">=1.33,<2.0" +langsmith = ">=0.0.63,<0.1.0" +packaging = ">=23.2,<24.0" +pydantic = ">=1,<3" +PyYAML = ">=5.3" +requests = ">=2,<3" +tenacity = ">=8.1.0,<9.0.0" + +[package.extras] +extended-testing = ["jinja2 (>=3,<4)"] + [[package]] name = "langsmith" -version = "0.0.75" +version = "0.0.77" description = "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform." optional = false python-versions = ">=3.8.1,<4.0" files = [ - {file = "langsmith-0.0.75-py3-none-any.whl", hash = "sha256:3e008854204c5eaae007f34c7e249059218605689c385c037f6a40cac044833b"}, - {file = "langsmith-0.0.75.tar.gz", hash = "sha256:3fd44c58bd53cb9366af3de129c7f11b6947914f1bb598a585240df0e2c566eb"}, + {file = "langsmith-0.0.77-py3-none-any.whl", hash = "sha256:750c0aa9177240c64e131d831e009ed08dd59038f7cabbd0bbcf62ccb7c8dcac"}, + {file = "langsmith-0.0.77.tar.gz", hash = "sha256:c4c8d3a96ad8671a41064f3ccc673e2e22a4153e823b19f915c9c9b8a4f33a2c"}, ] [package.dependencies] @@ -1930,12 +1956,12 @@ requests = ">=2,<3" [[package]] name = "llama-cpp-python" -version = "0.2.11" +version = "0.2.27" description = "Python bindings for the llama.cpp library" optional = false python-versions = ">=3.8" files = [ - {file = "llama_cpp_python-0.2.11.tar.gz", hash = "sha256:aae4820bb24aca61800bac771fb735dcc22b08c1374300782ab47eb65743723a"}, + {file = "llama_cpp_python-0.2.27.tar.gz", hash = "sha256:4f7228c38d0618ec80a76130ab4720693ea09efd5cd46920e075cadf00e6d060"}, ] [package.dependencies] @@ -1947,59 +1973,63 @@ typing-extensions = ">=4.5.0" all = ["llama_cpp_python[dev,server,test]"] dev = ["black (>=23.3.0)", "httpx (>=0.24.1)", "mkdocs (>=1.4.3)", "mkdocs-material (>=9.1.18)", "mkdocstrings[python] (>=0.22.0)", "pytest (>=7.4.0)", "twine (>=4.0.2)"] server = ["fastapi (>=0.100.0)", "pydantic-settings (>=2.0.1)", "sse-starlette (>=1.6.1)", "starlette-context (>=0.3.6,<0.4)", "uvicorn (>=0.22.0)"] -test = ["httpx (>=0.24.1)", "pytest (>=7.4.0)"] +test = ["httpx (>=0.24.1)", "pytest (>=7.4.0)", "scipy (>=1.10)"] [[package]] name = "llama-hub" -version = "0.0.42" +version = "0.0.69" description = "A library of community-driven data loaders for LLMs. Use with LlamaIndex and/or LangChain. " optional = false -python-versions = ">=3.8.1,<4.0" +python-versions = ">=3.8.1,<3.12" files = [ - {file = "llama_hub-0.0.42-py3-none-any.whl", hash = "sha256:e69c94553efc00057d8471e87b7fd34143f9d1ba3f1681a7f12c336f0c180053"}, - {file = "llama_hub-0.0.42.tar.gz", hash = "sha256:574e1889d221edd82633bc89d91f90fd4881aaf29cf31cd9bf0fe37ded5415df"}, + {file = "llama_hub-0.0.69-py3-none-any.whl", hash = "sha256:a70ea1dbf76fe81deb96e806ce12fc92691a15ee1e7ce1570c141c3575089ba1"}, + {file = "llama_hub-0.0.69.tar.gz", hash = "sha256:1688576b54ff5479b33ca34b08b30a32df4a1f6209a0592056024027ed38a341"}, ] [package.dependencies] -atlassian-python-api = "*" html2text = "*" -llama-index = ">=0.6.9" +llama-index = ">=0.9.29" psutil = "*" +pyaml = ">=23.9.7,<24.0.0" retrying = "*" [[package]] name = "llama-index" -version = "0.8.62" +version = "0.9.29" description = "Interface between LLMs and your data" optional = false -python-versions = ">=3.8.1,<3.12" +python-versions = ">=3.8.1,<4.0" files = [ - {file = "llama_index-0.8.62-py3-none-any.whl", hash = "sha256:5ea95e1a1ec0f759e29093c92cdfd3f1c780d3c638a306b86aa22993ab15ce80"}, - {file = "llama_index-0.8.62.tar.gz", hash = "sha256:c0db90f49ca8a11777b14e2a72921bef1edbf21ac5564651911999a9913f14ae"}, + {file = "llama_index-0.9.29-py3-none-any.whl", hash = "sha256:4ac6f589a2e8c5049882c185f25e6c57b68cf9d6e46a6f84102705a7dd357dd2"}, + {file = "llama_index-0.9.29.tar.gz", hash = "sha256:df5af84bf593cdf6a36da403f521bd5582eccbd6ca551da44d2e4e5b2b4f5619"}, ] [package.dependencies] -aiostream = ">=0.5.2,<0.6.0" -dataclasses-json = ">=0.5.7,<0.6.0" +aiohttp = ">=3.8.6,<4.0.0" +beautifulsoup4 = ">=4.12.2,<5.0.0" +dataclasses-json = "*" deprecated = ">=1.2.9.3" fsspec = ">=2023.5.0" -langchain = ">=0.0.303" +httpx = "*" nest-asyncio = ">=1.5.8,<2.0.0" +networkx = ">=3.0" nltk = ">=3.8.1,<4.0.0" numpy = "*" -openai = "<1" +openai = ">=1.1.0" pandas = "*" +requests = ">=2.31.0" SQLAlchemy = {version = ">=1.4.49", extras = ["asyncio"]} tenacity = ">=8.2.0,<9.0.0" tiktoken = ">=0.3.3" typing-extensions = ">=4.5.0" typing-inspect = ">=0.8.0" -urllib3 = "<2" [package.extras] -local-models = ["optimum[onnxruntime] (>=1.13.2,<2.0.0)", "sentencepiece (>=0.1.99,<0.2.0)", "transformers[torch] (>=4.34.0,<5.0.0)"] -postgres = ["asyncpg (>=0.28.0,<0.29.0)", "pgvector (>=0.1.0,<0.2.0)", "psycopg-binary (>=3.1.12,<4.0.0)"] -query-tools = ["guidance (>=0.0.64,<0.0.65)", "jsonpath-ng (>=1.6.0,<2.0.0)", "lm-format-enforcer (>=0.4.3,<0.5.0)", "rank-bm25 (>=0.2.2,<0.3.0)", "scikit-learn (<1.3.0)", "spacy (>=3.7.1,<4.0.0)"] +gradientai = ["gradientai (>=1.4.0)"] +langchain = ["langchain (>=0.0.303)"] +local-models = ["optimum[onnxruntime] (>=1.13.2,<2.0.0)", "sentencepiece (>=0.1.99,<0.2.0)", "transformers[torch] (>=4.33.1,<5.0.0)"] +postgres = ["asyncpg (>=0.28.0,<0.29.0)", "pgvector (>=0.1.0,<0.2.0)", "psycopg-binary (>=3.1.12,<4.0.0)", "psycopg2 (>=2.9.9,<3.0.0)"] +query-tools = ["guidance (>=0.0.64,<0.0.65)", "jsonpath-ng (>=1.6.0,<2.0.0)", "lm-format-enforcer (>=0.4.3,<0.5.0)", "rank-bm25 (>=0.2.2,<0.3.0)", "scikit-learn", "spacy (>=3.7.1,<4.0.0)"] [[package]] name = "markdown-it-py" @@ -2525,42 +2555,168 @@ files = [ ] [[package]] -name = "oauthlib" -version = "3.2.2" -description = "A generic, spec-compliant, thorough implementation of the OAuth request-signing logic" +name = "nvidia-cublas-cu12" +version = "12.1.3.1" +description = "CUBLAS native runtime libraries" optional = false -python-versions = ">=3.6" +python-versions = ">=3" files = [ - {file = "oauthlib-3.2.2-py3-none-any.whl", hash = "sha256:8139f29aac13e25d502680e9e19963e83f16838d48a0d71c287fe40e7067fbca"}, - {file = "oauthlib-3.2.2.tar.gz", hash = "sha256:9859c40929662bec5d64f34d01c99e093149682a3f38915dc0655d5a633dd918"}, + {file = "nvidia_cublas_cu12-12.1.3.1-py3-none-manylinux1_x86_64.whl", hash = "sha256:ee53ccca76a6fc08fb9701aa95b6ceb242cdaab118c3bb152af4e579af792728"}, + {file = "nvidia_cublas_cu12-12.1.3.1-py3-none-win_amd64.whl", hash = "sha256:2b964d60e8cf11b5e1073d179d85fa340c120e99b3067558f3cf98dd69d02906"}, ] -[package.extras] -rsa = ["cryptography (>=3.0.0)"] -signals = ["blinker (>=1.4.0)"] -signedtoken = ["cryptography (>=3.0.0)", "pyjwt (>=2.0.0,<3)"] +[[package]] +name = "nvidia-cuda-cupti-cu12" +version = "12.1.105" +description = "CUDA profiling tools runtime libs." +optional = false +python-versions = ">=3" +files = [ + {file = "nvidia_cuda_cupti_cu12-12.1.105-py3-none-manylinux1_x86_64.whl", hash = "sha256:e54fde3983165c624cb79254ae9818a456eb6e87a7fd4d56a2352c24ee542d7e"}, + {file = "nvidia_cuda_cupti_cu12-12.1.105-py3-none-win_amd64.whl", hash = "sha256:bea8236d13a0ac7190bd2919c3e8e6ce1e402104276e6f9694479e48bb0eb2a4"}, +] + +[[package]] +name = "nvidia-cuda-nvrtc-cu12" +version = "12.1.105" +description = "NVRTC native runtime libraries" +optional = false +python-versions = ">=3" +files = [ + {file = "nvidia_cuda_nvrtc_cu12-12.1.105-py3-none-manylinux1_x86_64.whl", hash = "sha256:339b385f50c309763ca65456ec75e17bbefcbbf2893f462cb8b90584cd27a1c2"}, + {file = "nvidia_cuda_nvrtc_cu12-12.1.105-py3-none-win_amd64.whl", hash = "sha256:0a98a522d9ff138b96c010a65e145dc1b4850e9ecb75a0172371793752fd46ed"}, +] + +[[package]] +name = "nvidia-cuda-runtime-cu12" +version = "12.1.105" +description = "CUDA Runtime native Libraries" +optional = false +python-versions = ">=3" +files = [ + {file = "nvidia_cuda_runtime_cu12-12.1.105-py3-none-manylinux1_x86_64.whl", hash = "sha256:6e258468ddf5796e25f1dc591a31029fa317d97a0a94ed93468fc86301d61e40"}, + {file = "nvidia_cuda_runtime_cu12-12.1.105-py3-none-win_amd64.whl", hash = "sha256:dfb46ef84d73fababab44cf03e3b83f80700d27ca300e537f85f636fac474344"}, +] + +[[package]] +name = "nvidia-cudnn-cu12" +version = "8.9.2.26" +description = "cuDNN runtime libraries" +optional = false +python-versions = ">=3" +files = [ + {file = "nvidia_cudnn_cu12-8.9.2.26-py3-none-manylinux1_x86_64.whl", hash = "sha256:5ccb288774fdfb07a7e7025ffec286971c06d8d7b4fb162525334616d7629ff9"}, +] + +[package.dependencies] +nvidia-cublas-cu12 = "*" + +[[package]] +name = "nvidia-cufft-cu12" +version = "11.0.2.54" +description = "CUFFT native runtime libraries" +optional = false +python-versions = ">=3" +files = [ + {file = "nvidia_cufft_cu12-11.0.2.54-py3-none-manylinux1_x86_64.whl", hash = "sha256:794e3948a1aa71fd817c3775866943936774d1c14e7628c74f6f7417224cdf56"}, + {file = "nvidia_cufft_cu12-11.0.2.54-py3-none-win_amd64.whl", hash = "sha256:d9ac353f78ff89951da4af698f80870b1534ed69993f10a4cf1d96f21357e253"}, +] + +[[package]] +name = "nvidia-curand-cu12" +version = "10.3.2.106" +description = "CURAND native runtime libraries" +optional = false +python-versions = ">=3" +files = [ + {file = "nvidia_curand_cu12-10.3.2.106-py3-none-manylinux1_x86_64.whl", hash = "sha256:9d264c5036dde4e64f1de8c50ae753237c12e0b1348738169cd0f8a536c0e1e0"}, + {file = "nvidia_curand_cu12-10.3.2.106-py3-none-win_amd64.whl", hash = "sha256:75b6b0c574c0037839121317e17fd01f8a69fd2ef8e25853d826fec30bdba74a"}, +] + +[[package]] +name = "nvidia-cusolver-cu12" +version = "11.4.5.107" +description = "CUDA solver native runtime libraries" +optional = false +python-versions = ">=3" +files = [ + {file = "nvidia_cusolver_cu12-11.4.5.107-py3-none-manylinux1_x86_64.whl", hash = "sha256:8a7ec542f0412294b15072fa7dab71d31334014a69f953004ea7a118206fe0dd"}, + {file = "nvidia_cusolver_cu12-11.4.5.107-py3-none-win_amd64.whl", hash = "sha256:74e0c3a24c78612192a74fcd90dd117f1cf21dea4822e66d89e8ea80e3cd2da5"}, +] + +[package.dependencies] +nvidia-cublas-cu12 = "*" +nvidia-cusparse-cu12 = "*" +nvidia-nvjitlink-cu12 = "*" + +[[package]] +name = "nvidia-cusparse-cu12" +version = "12.1.0.106" +description = "CUSPARSE native runtime libraries" +optional = false +python-versions = ">=3" +files = [ + {file = "nvidia_cusparse_cu12-12.1.0.106-py3-none-manylinux1_x86_64.whl", hash = "sha256:f3b50f42cf363f86ab21f720998517a659a48131e8d538dc02f8768237bd884c"}, + {file = "nvidia_cusparse_cu12-12.1.0.106-py3-none-win_amd64.whl", hash = "sha256:b798237e81b9719373e8fae8d4f091b70a0cf09d9d85c95a557e11df2d8e9a5a"}, +] + +[package.dependencies] +nvidia-nvjitlink-cu12 = "*" + +[[package]] +name = "nvidia-nccl-cu12" +version = "2.18.1" +description = "NVIDIA Collective Communication Library (NCCL) Runtime" +optional = false +python-versions = ">=3" +files = [ + {file = "nvidia_nccl_cu12-2.18.1-py3-none-manylinux1_x86_64.whl", hash = "sha256:1a6c4acefcbebfa6de320f412bf7866de856e786e0462326ba1bac40de0b5e71"}, +] + +[[package]] +name = "nvidia-nvjitlink-cu12" +version = "12.3.101" +description = "Nvidia JIT LTO Library" +optional = false +python-versions = ">=3" +files = [ + {file = "nvidia_nvjitlink_cu12-12.3.101-py3-none-manylinux1_x86_64.whl", hash = "sha256:64335a8088e2b9d196ae8665430bc6a2b7e6ef2eb877a9c735c804bd4ff6467c"}, + {file = "nvidia_nvjitlink_cu12-12.3.101-py3-none-win_amd64.whl", hash = "sha256:1b2e317e437433753530792f13eece58f0aec21a2b05903be7bffe58a606cbd1"}, +] + +[[package]] +name = "nvidia-nvtx-cu12" +version = "12.1.105" +description = "NVIDIA Tools Extension" +optional = false +python-versions = ">=3" +files = [ + {file = "nvidia_nvtx_cu12-12.1.105-py3-none-manylinux1_x86_64.whl", hash = "sha256:dc21cf308ca5691e7c04d962e213f8a4aa9bbfa23d95412f452254c2caeb09e5"}, + {file = "nvidia_nvtx_cu12-12.1.105-py3-none-win_amd64.whl", hash = "sha256:65f4d98982b31b60026e0e6de73fbdfc09d08a96f4656dd3665ca616a11e1e82"}, +] [[package]] name = "openai" -version = "0.27.10" -description = "Python client library for the OpenAI API" +version = "1.6.1" +description = "The official Python library for the openai API" optional = false python-versions = ">=3.7.1" files = [ - {file = "openai-0.27.10-py3-none-any.whl", hash = "sha256:beabd1757e3286fa166dde3b70ebb5ad8081af046876b47c14c41e203ed22a14"}, - {file = "openai-0.27.10.tar.gz", hash = "sha256:60e09edf7100080283688748c6803b7b3b52d5a55d21890f3815292a0552d83b"}, + {file = "openai-1.6.1-py3-none-any.whl", hash = "sha256:bc9f774838d67ac29fb24cdeb2d58faf57de8b311085dcd1348f7aa02a96c7ee"}, + {file = "openai-1.6.1.tar.gz", hash = "sha256:d553ca9dbf9486b08e75b09e8671e4f638462aaadccfced632bf490fc3d75fa2"}, ] [package.dependencies] -aiohttp = "*" -requests = ">=2.20" -tqdm = "*" +anyio = ">=3.5.0,<5" +distro = ">=1.7.0,<2" +httpx = ">=0.23.0,<1" +pydantic = ">=1.9.0,<3" +sniffio = "*" +tqdm = ">4" +typing-extensions = ">=4.7,<5" [package.extras] -datalib = ["numpy", "openpyxl (>=3.0.7)", "pandas (>=1.2.3)", "pandas-stubs (>=1.1.0.11)"] -dev = ["black (>=21.6b0,<22.0)", "pytest (==6.*)", "pytest-asyncio", "pytest-mock"] -embeddings = ["matplotlib", "numpy", "openpyxl (>=3.0.7)", "pandas (>=1.2.3)", "pandas-stubs (>=1.1.0.11)", "plotly", "scikit-learn (>=1.0.2)", "scipy", "tenacity (>=8.0.1)"] -wandb = ["numpy", "openpyxl (>=3.0.7)", "pandas (>=1.2.3)", "pandas-stubs (>=1.1.0.11)", "wandb"] +datalib = ["numpy (>=1)", "pandas (>=1.2.3)", "pandas-stubs (>=1.1.0.11)"] [[package]] name = "orjson" @@ -2958,12 +3114,12 @@ files = [ [[package]] name = "pulumi" -version = "3.85.0" +version = "3.100.0" description = "Pulumi's Python SDK" optional = true python-versions = ">=3.7" files = [ - {file = "pulumi-3.85.0-py3-none-any.whl", hash = "sha256:d78556534cc3c19c43157a6a3798203baabcd790c46f72cc99ecf3c1b5166ffc"}, + {file = "pulumi-3.100.0-py3-none-any.whl", hash = "sha256:97407d4fea164fa9a61a4a2514ae33ac83884a919fb283b28001d9bfe0df1ef0"}, ] [package.dependencies] @@ -2976,12 +3132,13 @@ six = ">=1.12,<2.0" [[package]] name = "pulumi-azure-native" -version = "1.104.0" +version = "2.24.0" description = "A native Pulumi package for creating and managing Azure resources." optional = true python-versions = ">=3.7" files = [ - {file = "pulumi_azure_native-1.104.0.tar.gz", hash = "sha256:52759f143dac241311186357f8c3f224844232dc604b6cbe79fd54df4a2c92bf"}, + {file = "pulumi_azure_native-2.24.0-py3-none-any.whl", hash = "sha256:e2931a6aaca8a6612369b83a49505b3ba92fa76245fa755c121a759d01082013"}, + {file = "pulumi_azure_native-2.24.0.tar.gz", hash = "sha256:6f29f1eda16892299501c9cf8609c02bbc9deb4e71f3657915edc59e6670b67d"}, ] [package.dependencies] @@ -3003,6 +3160,23 @@ files = [ [package.extras] tests = ["pytest"] +[[package]] +name = "pyaml" +version = "23.12.0" +description = "PyYAML-based module to produce a bit more pretty and readable YAML-serialized data" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pyaml-23.12.0-py3-none-any.whl", hash = "sha256:90407d74c95a55d9b41d3860fcc1759640444d2795df748a328d077bc4f58393"}, + {file = "pyaml-23.12.0.tar.gz", hash = "sha256:ce6f648efdfb1b3a5579f8cedb04facf0fa1e8f64846b639309b585bb322b4e5"}, +] + +[package.dependencies] +PyYAML = "*" + +[package.extras] +anchors = ["unidecode"] + [[package]] name = "pyarrow" version = "14.0.1" @@ -3608,24 +3782,6 @@ urllib3 = ">=1.21.1,<3" socks = ["PySocks (>=1.5.6,!=1.5.7)"] use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] -[[package]] -name = "requests-oauthlib" -version = "1.3.1" -description = "OAuthlib authentication support for Requests." -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -files = [ - {file = "requests-oauthlib-1.3.1.tar.gz", hash = "sha256:75beac4a47881eeb94d5ea5d6ad31ef88856affe2332b9aafb52c6452ccf0d7a"}, - {file = "requests_oauthlib-1.3.1-py2.py3-none-any.whl", hash = "sha256:2577c501a2fb8d05a304c09d090d6e47c306fef15809d102b327cf8364bddab5"}, -] - -[package.dependencies] -oauthlib = ">=3.0.0" -requests = ">=2.0.0" - -[package.extras] -rsa = ["oauthlib[signedtoken] (>=3.0.0)"] - [[package]] name = "retrying" version = "1.3.4" @@ -4085,18 +4241,18 @@ files = [ [[package]] name = "slack-sdk" -version = "3.22.0" +version = "3.26.1" description = "The Slack API Platform SDK for Python" optional = false python-versions = ">=3.6.0" files = [ - {file = "slack_sdk-3.22.0-py2.py3-none-any.whl", hash = "sha256:f102a4902115dff3b97c3e8883ad4e22d54732221886fc5ef29bfc290f063b4a"}, - {file = "slack_sdk-3.22.0.tar.gz", hash = "sha256:6eacce0fa4f8cfb4d84eac0d7d7e1b1926040a2df654ae86b94179bdf2bc4d8c"}, + {file = "slack_sdk-3.26.1-py2.py3-none-any.whl", hash = "sha256:f80f0d15f0fce539b470447d2a07b03ecdad6b24f69c1edd05d464cf21253a06"}, + {file = "slack_sdk-3.26.1.tar.gz", hash = "sha256:d1600211eaa37c71a5f92daf4404074c3e6b3f5359a37c93c818b39d88ab4ca0"}, ] [package.extras] optional = ["SQLAlchemy (>=1.4,<3)", "aiodns (>1.0)", "aiohttp (>=3.7.3,<4)", "boto3 (<=2)", "websocket-client (>=1,<2)", "websockets (>=10,<11)"] -testing = ["Flask (>=1,<2)", "Flask-Sockets (>=0.2,<1)", "Jinja2 (==3.0.3)", "Werkzeug (<2)", "black (==22.8.0)", "boto3 (<=2)", "click (==8.0.4)", "flake8 (>=5,<6)", "itsdangerous (==1.1.0)", "moto (>=3,<4)", "psutil (>=5,<6)", "pytest (>=6.2.5,<7)", "pytest-asyncio (<1)", "pytest-cov (>=2,<3)"] +testing = ["Flask (>=1,<2)", "Flask-Sockets (>=0.2,<1)", "Jinja2 (==3.0.3)", "Werkzeug (<2)", "black (==22.8.0)", "boto3 (<=2)", "click (==8.0.4)", "flake8 (>=5.0.4,<7)", "itsdangerous (==1.1.0)", "moto (>=3,<4)", "psutil (>=5,<6)", "pytest (>=7.0.1,<8)", "pytest-asyncio (<1)", "pytest-cov (>=2,<3)"] [[package]] name = "smmap" @@ -4124,7 +4280,7 @@ files = [ name = "soupsieve" version = "2.5" description = "A modern CSS selector implementation for Beautiful Soup." -optional = true +optional = false python-versions = ">=3.8" files = [ {file = "soupsieve-2.5-py3-none-any.whl", hash = "sha256:eaa337ff55a1579b6549dc679565eac1e3d000563bcb1c8ab0d0fefbc0c2cdc7"}, @@ -4486,77 +4642,91 @@ files = [ [[package]] name = "torch" -version = "2.0.1" +version = "2.1.2" description = "Tensors and Dynamic neural networks in Python with strong GPU acceleration" optional = false python-versions = ">=3.8.0" files = [ - {file = "torch-2.0.1-cp310-cp310-manylinux1_x86_64.whl", hash = "sha256:8ced00b3ba471856b993822508f77c98f48a458623596a4c43136158781e306a"}, - {file = "torch-2.0.1-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:359bfaad94d1cda02ab775dc1cc386d585712329bb47b8741607ef6ef4950747"}, - {file = "torch-2.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:7c84e44d9002182edd859f3400deaa7410f5ec948a519cc7ef512c2f9b34d2c4"}, - {file = "torch-2.0.1-cp310-none-macosx_10_9_x86_64.whl", hash = "sha256:567f84d657edc5582d716900543e6e62353dbe275e61cdc36eda4929e46df9e7"}, - {file = "torch-2.0.1-cp310-none-macosx_11_0_arm64.whl", hash = "sha256:787b5a78aa7917465e9b96399b883920c88a08f4eb63b5a5d2d1a16e27d2f89b"}, - {file = "torch-2.0.1-cp311-cp311-manylinux1_x86_64.whl", hash = "sha256:e617b1d0abaf6ced02dbb9486803abfef0d581609b09641b34fa315c9c40766d"}, - {file = "torch-2.0.1-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:b6019b1de4978e96daa21d6a3ebb41e88a0b474898fe251fd96189587408873e"}, - {file = "torch-2.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:dbd68cbd1cd9da32fe5d294dd3411509b3d841baecb780b38b3b7b06c7754434"}, - {file = "torch-2.0.1-cp311-none-macosx_10_9_x86_64.whl", hash = "sha256:ef654427d91600129864644e35deea761fb1fe131710180b952a6f2e2207075e"}, - {file = "torch-2.0.1-cp311-none-macosx_11_0_arm64.whl", hash = "sha256:25aa43ca80dcdf32f13da04c503ec7afdf8e77e3a0183dd85cd3e53b2842e527"}, - {file = "torch-2.0.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:5ef3ea3d25441d3957348f7e99c7824d33798258a2bf5f0f0277cbcadad2e20d"}, - {file = "torch-2.0.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:0882243755ff28895e8e6dc6bc26ebcf5aa0911ed81b2a12f241fc4b09075b13"}, - {file = "torch-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:f66aa6b9580a22b04d0af54fcd042f52406a8479e2b6a550e3d9f95963e168c8"}, - {file = "torch-2.0.1-cp38-none-macosx_10_9_x86_64.whl", hash = "sha256:1adb60d369f2650cac8e9a95b1d5758e25d526a34808f7448d0bd599e4ae9072"}, - {file = "torch-2.0.1-cp38-none-macosx_11_0_arm64.whl", hash = "sha256:1bcffc16b89e296826b33b98db5166f990e3b72654a2b90673e817b16c50e32b"}, - {file = "torch-2.0.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:e10e1597f2175365285db1b24019eb6f04d53dcd626c735fc502f1e8b6be9875"}, - {file = "torch-2.0.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:423e0ae257b756bb45a4b49072046772d1ad0c592265c5080070e0767da4e490"}, - {file = "torch-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:8742bdc62946c93f75ff92da00e3803216c6cce9b132fbca69664ca38cfb3e18"}, - {file = "torch-2.0.1-cp39-none-macosx_10_9_x86_64.whl", hash = "sha256:c62df99352bd6ee5a5a8d1832452110435d178b5164de450831a3a8cc14dc680"}, - {file = "torch-2.0.1-cp39-none-macosx_11_0_arm64.whl", hash = "sha256:671a2565e3f63b8fe8e42ae3e36ad249fe5e567435ea27b94edaa672a7d0c416"}, + {file = "torch-2.1.2-cp310-cp310-manylinux1_x86_64.whl", hash = "sha256:3a871edd6c02dae77ad810335c0833391c1a4ce49af21ea8cf0f6a5d2096eea8"}, + {file = "torch-2.1.2-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:bef6996c27d8f6e92ea4e13a772d89611da0e103b48790de78131e308cf73076"}, + {file = "torch-2.1.2-cp310-cp310-win_amd64.whl", hash = "sha256:0e13034fd5fb323cbbc29e56d0637a3791e50dd589616f40c79adfa36a5a35a1"}, + {file = "torch-2.1.2-cp310-none-macosx_10_9_x86_64.whl", hash = "sha256:d9b535cad0df3d13997dbe8bd68ac33e0e3ae5377639c9881948e40794a61403"}, + {file = "torch-2.1.2-cp310-none-macosx_11_0_arm64.whl", hash = "sha256:f9a55d55af02826ebfbadf4e9b682f0f27766bc33df8236b48d28d705587868f"}, + {file = "torch-2.1.2-cp311-cp311-manylinux1_x86_64.whl", hash = "sha256:a6ebbe517097ef289cc7952783588c72de071d4b15ce0f8b285093f0916b1162"}, + {file = "torch-2.1.2-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:8f32ce591616a30304f37a7d5ea80b69ca9e1b94bba7f308184bf616fdaea155"}, + {file = "torch-2.1.2-cp311-cp311-win_amd64.whl", hash = "sha256:e0ee6cf90c8970e05760f898d58f9ac65821c37ffe8b04269ec787aa70962b69"}, + {file = "torch-2.1.2-cp311-none-macosx_10_9_x86_64.whl", hash = "sha256:76d37967c31c99548ad2c4d3f2cf191db48476f2e69b35a0937137116da356a1"}, + {file = "torch-2.1.2-cp311-none-macosx_11_0_arm64.whl", hash = "sha256:e2d83f07b4aac983453ea5bf8f9aa9dacf2278a8d31247f5d9037f37befc60e4"}, + {file = "torch-2.1.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:f41fe0c7ecbf903a568c73486139a75cfab287a0f6c17ed0698fdea7a1e8641d"}, + {file = "torch-2.1.2-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:e3225f47d50bb66f756fe9196a768055d1c26b02154eb1f770ce47a2578d3aa7"}, + {file = "torch-2.1.2-cp38-cp38-win_amd64.whl", hash = "sha256:33d59cd03cb60106857f6c26b36457793637512998666ee3ce17311f217afe2b"}, + {file = "torch-2.1.2-cp38-none-macosx_10_9_x86_64.whl", hash = "sha256:8e221deccd0def6c2badff6be403e0c53491805ed9915e2c029adbcdb87ab6b5"}, + {file = "torch-2.1.2-cp38-none-macosx_11_0_arm64.whl", hash = "sha256:05b18594f60a911a0c4f023f38a8bda77131fba5fd741bda626e97dcf5a3dd0a"}, + {file = "torch-2.1.2-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:9ca96253b761e9aaf8e06fb30a66ee301aecbf15bb5a303097de1969077620b6"}, + {file = "torch-2.1.2-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:d93ba70f67b08c2ae5598ee711cbc546a1bc8102cef938904b8c85c2089a51a0"}, + {file = "torch-2.1.2-cp39-cp39-win_amd64.whl", hash = "sha256:255b50bc0608db177e6a3cc118961d77de7e5105f07816585fa6f191f33a9ff3"}, + {file = "torch-2.1.2-cp39-none-macosx_10_9_x86_64.whl", hash = "sha256:6984cd5057c0c977b3c9757254e989d3f1124f4ce9d07caa6cb637783c71d42a"}, + {file = "torch-2.1.2-cp39-none-macosx_11_0_arm64.whl", hash = "sha256:bc195d7927feabc0eb7c110e457c955ed2ab616f3c7c28439dd4188cf589699f"}, ] [package.dependencies] filelock = "*" +fsspec = "*" jinja2 = "*" networkx = "*" +nvidia-cublas-cu12 = {version = "12.1.3.1", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""} +nvidia-cuda-cupti-cu12 = {version = "12.1.105", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""} +nvidia-cuda-nvrtc-cu12 = {version = "12.1.105", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""} +nvidia-cuda-runtime-cu12 = {version = "12.1.105", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""} +nvidia-cudnn-cu12 = {version = "8.9.2.26", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""} +nvidia-cufft-cu12 = {version = "11.0.2.54", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""} +nvidia-curand-cu12 = {version = "10.3.2.106", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""} +nvidia-cusolver-cu12 = {version = "11.4.5.107", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""} +nvidia-cusparse-cu12 = {version = "12.1.0.106", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""} +nvidia-nccl-cu12 = {version = "2.18.1", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""} +nvidia-nvtx-cu12 = {version = "12.1.105", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""} sympy = "*" +triton = {version = "2.1.0", markers = "platform_system == \"Linux\" and platform_machine == \"x86_64\""} typing-extensions = "*" [package.extras] +dynamo = ["jinja2"] opt-einsum = ["opt-einsum (>=3.3)"] [[package]] name = "torchvision" -version = "0.15.2" +version = "0.16.2" description = "image and video datasets and models for torch deep learning" optional = false python-versions = ">=3.8" files = [ - {file = "torchvision-0.15.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7754088774e810c5672b142a45dcf20b1bd986a5a7da90f8660c43dc43fb850c"}, - {file = "torchvision-0.15.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:37eb138e13f6212537a3009ac218695483a635c404b6cc1d8e0d0d978026a86d"}, - {file = "torchvision-0.15.2-cp310-cp310-manylinux1_x86_64.whl", hash = "sha256:54143f7cc0797d199b98a53b7d21c3f97615762d4dd17ad45a41c7e80d880e73"}, - {file = "torchvision-0.15.2-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:1eefebf5fbd01a95fe8f003d623d941601c94b5cec547b420da89cb369d9cf96"}, - {file = "torchvision-0.15.2-cp310-cp310-win_amd64.whl", hash = "sha256:96fae30c5ca8423f4b9790df0f0d929748e32718d88709b7b567d2f630c042e3"}, - {file = "torchvision-0.15.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5f35f6bd5bcc4568e6522e4137fa60fcc72f4fa3e615321c26cd87e855acd398"}, - {file = "torchvision-0.15.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:757505a0ab2be7096cb9d2bf4723202c971cceddb72c7952a7e877f773de0f8a"}, - {file = "torchvision-0.15.2-cp311-cp311-manylinux1_x86_64.whl", hash = "sha256:012ad25cfd9019ff9b0714a168727e3845029be1af82296ff1e1482931fa4b80"}, - {file = "torchvision-0.15.2-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:b02a7ffeaa61448737f39a4210b8ee60234bda0515a0c0d8562f884454105b0f"}, - {file = "torchvision-0.15.2-cp311-cp311-win_amd64.whl", hash = "sha256:10be76ceded48329d0a0355ac33da131ee3993ff6c125e4a02ab34b5baa2472c"}, - {file = "torchvision-0.15.2-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:8f12415b686dba884fb086f53ac803f692be5a5cdd8a758f50812b30fffea2e4"}, - {file = "torchvision-0.15.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:31211c01f8b8ec33b8a638327b5463212e79a03e43c895f88049f97af1bd12fd"}, - {file = "torchvision-0.15.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:c55f9889e436f14b4f84a9c00ebad0d31f5b4626f10cf8018e6c676f92a6d199"}, - {file = "torchvision-0.15.2-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:9a192f2aa979438f23c20e883980b23d13268ab9f819498774a6d2eb021802c2"}, - {file = "torchvision-0.15.2-cp38-cp38-win_amd64.whl", hash = "sha256:c07071bc8d02aa8fcdfe139ab6a1ef57d3b64c9e30e84d12d45c9f4d89fb6536"}, - {file = "torchvision-0.15.2-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4790260fcf478a41c7ecc60a6d5200a88159fdd8d756e9f29f0f8c59c4a67a68"}, - {file = "torchvision-0.15.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:987ab62225b4151a11e53fd06150c5258ced24ac9d7c547e0e4ab6fbca92a5ce"}, - {file = "torchvision-0.15.2-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:63df26673e66cba3f17e07c327a8cafa3cce98265dbc3da329f1951d45966838"}, - {file = "torchvision-0.15.2-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:b85f98d4cc2f72452f6792ab4463a3541bc5678a8cdd3da0e139ba2fe8b56d42"}, - {file = "torchvision-0.15.2-cp39-cp39-win_amd64.whl", hash = "sha256:07c462524cc1bba5190c16a9d47eac1fca024d60595a310f23c00b4ffff18b30"}, + {file = "torchvision-0.16.2-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:bc86f2800cb2c0c1a09c581409cdd6bff66e62f103dc83fc63f73346264c3756"}, + {file = "torchvision-0.16.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:b024bd412df6d3a007dcebf311a894eb3c5c21e1af80d12be382bbcb097a7c3a"}, + {file = "torchvision-0.16.2-cp310-cp310-manylinux1_x86_64.whl", hash = "sha256:e89f10f3c8351972b6e3fda95bc3e479ea8dbfc9dfcfd2c32902dbad4ba5cfc5"}, + {file = "torchvision-0.16.2-cp310-cp310-manylinux2014_aarch64.whl", hash = "sha256:96c7583700112a410bdc4e1e4f118c429dab49c29c9a31a2cc3579bc9b08b19d"}, + {file = "torchvision-0.16.2-cp310-cp310-win_amd64.whl", hash = "sha256:9f4032ebb3277fb07ff6a9b818d50a547fb8fcd89d958cfd9e773322454bb688"}, + {file = "torchvision-0.16.2-cp311-cp311-macosx_10_13_x86_64.whl", hash = "sha256:67b1aaf8b8cb02ce75dd445f291a27c8036a502f8c0aa76e28c37a0faac2e153"}, + {file = "torchvision-0.16.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:bef30d03e1d1c629761f4dca51d3b7d8a0dc0acce6f4068ab2a1634e8e7b64e0"}, + {file = "torchvision-0.16.2-cp311-cp311-manylinux1_x86_64.whl", hash = "sha256:e59cc7b2bd1ab5c0ce4ae382e4e37be8f1c174e8b5de2f6a23c170de9ae28495"}, + {file = "torchvision-0.16.2-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:e130b08cc9b3cc73a6c59d6edf032394a322f9579bfd21d14bc2e1d0999aa758"}, + {file = "torchvision-0.16.2-cp311-cp311-win_amd64.whl", hash = "sha256:8692ab1e48807e9604046a6f4beeb67b523294cee1b00828654bb0df2cfce2b2"}, + {file = "torchvision-0.16.2-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:b82732dcf876a37c852772342aa6ee3480c03bb3e2a802ae109fc5f7e28d26e9"}, + {file = "torchvision-0.16.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:4b065143d1a720fe8a9077fd4be35d491f98819ec80b3dbbc3ec64d0b707a906"}, + {file = "torchvision-0.16.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:bc5f274e4ecd1b86062063cdf4fd385a1d39d147a3a2685fbbde9ff08bb720b8"}, + {file = "torchvision-0.16.2-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:335959c43b371c0474af34c1ef2a52efdc7603c45700d29e4475eeb02984170c"}, + {file = "torchvision-0.16.2-cp38-cp38-win_amd64.whl", hash = "sha256:7fd22d86e08eba321af70cad291020c2cdeac069b00ce88b923ca52e06174769"}, + {file = "torchvision-0.16.2-cp39-cp39-macosx_10_13_x86_64.whl", hash = "sha256:56115268b37f0b75364e3654e47ad9abc66ac34c1f9e5e3dfa89a22d6a40017a"}, + {file = "torchvision-0.16.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:82805f8445b094f9d1e770390ee6cc86855e89955e08ce34af2e2274fc0e5c45"}, + {file = "torchvision-0.16.2-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:3f4bd5fcbc361476e2e78016636ac7d5509e59d9962521f06eb98e6803898182"}, + {file = "torchvision-0.16.2-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:8199acdf8ab066a28b84a5b6f4d97b58976d9e164b1acc3a9d14fccfaf74bb3a"}, + {file = "torchvision-0.16.2-cp39-cp39-win_amd64.whl", hash = "sha256:41dd4fa9f176d563fe9f1b9adef3b7e582cdfb60ce8c9bc51b094a025be687c9"}, ] [package.dependencies] numpy = "*" pillow = ">=5.3.0,<8.3.dev0 || >=8.4.dev0" requests = "*" -torch = "2.0.1" +torch = "2.1.2" [package.extras] scipy = ["scipy"] @@ -4684,6 +4854,31 @@ torchhub = ["filelock", "huggingface-hub (>=0.19.3,<1.0)", "importlib-metadata", video = ["av (==9.2.0)", "decord (==0.6.0)"] vision = ["Pillow (>=10.0.1,<=15.0)"] +[[package]] +name = "triton" +version = "2.1.0" +description = "A language and compiler for custom Deep Learning operations" +optional = false +python-versions = "*" +files = [ + {file = "triton-2.1.0-0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:66439923a30d5d48399b08a9eae10370f6c261a5ec864a64983bae63152d39d7"}, + {file = "triton-2.1.0-0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:919b06453f0033ea52c13eaf7833de0e57db3178d23d4e04f9fc71c4f2c32bf8"}, + {file = "triton-2.1.0-0-cp37-cp37m-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ae4bb8a91de790e1866405211c4d618379781188f40d5c4c399766914e84cd94"}, + {file = "triton-2.1.0-0-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:39f6fb6bdccb3e98f3152e3fbea724f1aeae7d749412bbb1fa9c441d474eba26"}, + {file = "triton-2.1.0-0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:21544e522c02005a626c8ad63d39bdff2f31d41069592919ef281e964ed26446"}, + {file = "triton-2.1.0-0-pp37-pypy37_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:143582ca31dd89cd982bd3bf53666bab1c7527d41e185f9e3d8a3051ce1b663b"}, + {file = "triton-2.1.0-0-pp38-pypy38_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:82fc5aeeedf6e36be4e4530cbdcba81a09d65c18e02f52dc298696d45721f3bd"}, + {file = "triton-2.1.0-0-pp39-pypy39_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:81a96d110a738ff63339fc892ded095b31bd0d205e3aace262af8400d40b6fa8"}, +] + +[package.dependencies] +filelock = "*" + +[package.extras] +build = ["cmake (>=3.18)", "lit"] +tests = ["autopep8", "flake8", "isort", "numpy", "pytest", "scipy (>=1.7.1)"] +tutorials = ["matplotlib", "pandas", "tabulate"] + [[package]] name = "typer" version = "0.9.0" @@ -5174,4 +5369,4 @@ llama-index-notebooks = ["bitsandbytes", "gradio", "ipykernel", "nbconvert"] [metadata] lock-version = "2.0" python-versions = ">=3.11,<3.12" -content-hash = "2a3cf8bcb829a00ee01878e4de5002e9771f9f25e2f906ee7addd32b38ef73b8" +content-hash = "ff120f8eb56ccb830e279c58fd0a77291d939819db4fd830d7ee81c0bfaa9621" diff --git a/pyproject.toml b/pyproject.toml index 92d02b33..885e400e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,26 +22,26 @@ bitsandbytes = { version="^0.41.1", optional=true } datasets = { version="^2.16.1", optional=true } faiss-cpu = { version="^1.7.4", optional=true } fastapi = { version="^0.103.1", optional=true } -gitpython = "^3.1.36" +gitpython = "^3.1.41" gradio = { version = "^4.12.0", optional=true } httpx = "^0.26.0" ipykernel = { version="^6.23.2", optional=true } -langchain = "^0.0.329" -llama-cpp-python = "^0.2.11" -llama-index = "^0.8.62" -llama-hub = "^0.0.42" +langchain = "^0.0.354" +llama-cpp-python = "^0.2.27" +llama-index = "^0.9.29" +llama-hub = "^0.0.69" nbconvert = { version = "^7.8.0", optional = true } nest_asyncio = "^1.5.8" -openai = "^0.27.8" +openai = "^1.6.1" pandas = "^2.0.2" -pulumi = { version="^3.70.0", optional=true } -pulumi-azure-native = { version="^1.103.0", optional=true } +pulumi = { version = "^3.100.0", optional=true } +pulumi-azure-native = { version = "^2.24.0", optional=true } pydantic = { version = "^2.4.1", optional=true } requests = { version = "^2.31.0", optional=true } safetensors = "^0.3.3" -slack-sdk = "^3.21.3" +slack-sdk = "^3.26.1" sentence-transformers = "^2.2.2" -torch = "^2.0.1" +torch = "^2.1.2" transformers = "^4.36.2" uvicorn = { version="^0.23.2", optional=true } diff --git a/reginald/models/models/chat_completion.py b/reginald/models/models/chat_completion.py index d71fbf5f..9112b5c4 100644 --- a/reginald/models/models/chat_completion.py +++ b/reginald/models/models/chat_completion.py @@ -1,8 +1,10 @@ import logging import os +import sys from typing import Any import openai +from openai import AzureOpenAI, OpenAI from reginald.models.models.base import MessageResponse, ResponseModel from reginald.utils import get_env_var @@ -18,7 +20,11 @@ def __init__(self, *args, **kwargs) -> None: class ChatCompletionAzure(ChatCompletionBase): def __init__( - self, model_name: str = "reginald-curie", *args: Any, **kwargs: Any + self, + model_name: str = "reginald-gpt4", + mode: str = "chat", + *args: Any, + **kwargs: Any, ) -> None: """ Simple chat completion model using Azure's @@ -32,21 +38,39 @@ def __init__( Parameters ---------- model_name : str, optional - Deployment name of the model on Azure, by default "reginald-curie" + Deployment name of the model on Azure, by default "reginald-gpt4" + mode : Optional[str], optional + The type of engine to use when interacting with the model, + options of "chat" (where a chat completion is requested) + or "query" (where a completion in requested). Default is "chat". """ logging.info(f"Setting up AzureOpenAI LLM (model {model_name})") + if mode == "chat": + logging.info("Setting up chat engine.") + elif mode == "query": + logging.info("Setting up query engine.") + else: + logging.error("Mode must either be 'query' or 'chat'.") + sys.exit(1) + super().__init__(*args, **kwargs) self.api_base = get_env_var("OPENAI_AZURE_API_BASE", secret_value=False) self.api_key = get_env_var("OPENAI_AZURE_API_KEY") self.api_type = "azure" - self.api_version = "2023-03-15-preview" + self.api_version = "2023-09-15-preview" self.best_of = 1 self.engine = model_name # the deployment name self.frequency_penalty = 0 - self.max_tokens = 100 + self.max_tokens = 512 self.presence_penalty = 0 self.temperature = 0.2 self.top_p = 0.95 + self.client = AzureOpenAI( + api_key=self.api_key, + azure_endpoint=self.api_base, + api_version=self.api_version, + ) + self.mode = mode def _respond(self, message: str, user_id: str) -> MessageResponse: """ @@ -68,18 +92,32 @@ def _respond(self, message: str, user_id: str) -> MessageResponse: openai.api_type = self.api_type openai.api_version = self.api_version openai.api_key = self.api_key - response = openai.Completion.create( - best_of=self.best_of, - engine=self.engine, - frequency_penalty=self.frequency_penalty, - max_tokens=self.max_tokens, - presence_penalty=self.presence_penalty, - prompt=message, - stop=None, - temperature=self.temperature, - top_p=self.top_p, - ) - return MessageResponse(response["choices"][0]["text"]) + if self.mode == "chat": + response = self.client.chat.completions.create( + model=self.engine, + messages=[{"role": "user", "content": message}], + frequency_penalty=self.frequency_penalty, + max_tokens=self.max_tokens, + presence_penalty=self.presence_penalty, + stop=None, + temperature=self.temperature, + top_p=self.top_p, + ) + + return MessageResponse(response.choices[0].message.content) + elif self.mode == "query": + response = self.client.completions.create( + model=self.engine, + frequency_penalty=self.frequency_penalty, + max_tokens=self.max_tokens, + presence_penalty=self.presence_penalty, + prompt=message, + stop=None, + temperature=self.temperature, + top_p=self.top_p, + ) + + return MessageResponse(response.choices[0].text) def direct_message(self, message: str, user_id: str) -> MessageResponse: """ @@ -135,6 +173,7 @@ def __init__( super().__init__(*args, **kwargs) self.model_name = model_name self.api_key = get_env_var("OPENAI_API_KEY") + self.client = OpenAI(api_key=self.api_key) def _respond(self, message: str, user_id: str) -> MessageResponse: """ @@ -153,8 +192,9 @@ def _respond(self, message: str, user_id: str) -> MessageResponse: Response from the query engine. """ openai.api_key = self.api_key - response = openai.ChatCompletion.create( - model=self.model_name, messages=[{"role": "user", "content": message}] + response = self.client.chat.completions.create( + model=self.model_name, + messages=[{"role": "user", "content": message}], ) return MessageResponse(response["choices"][0]["message"]["content"]) diff --git a/reginald/models/models/llama_index.py b/reginald/models/models/llama_index.py index 69434927..7bedcd39 100644 --- a/reginald/models/models/llama_index.py +++ b/reginald/models/models/llama_index.py @@ -32,7 +32,7 @@ ) from llama_index.indices.vector_store.base import VectorStoreIndex from llama_index.llms import AzureOpenAI, HuggingFaceLLM, LlamaCPP, OpenAI -from llama_index.llms.base import LLM +from llama_index.llms.base import BaseLLM from llama_index.llms.llama_utils import completion_to_prompt, messages_to_prompt from llama_index.prompts import PromptTemplate from llama_index.readers import SimpleDirectoryReader @@ -67,7 +67,7 @@ def compute_default_chunk_size(max_input_size: int, k: int) -> int: def setup_service_context( - llm: LLM, + llm: BaseLLM, max_input_size: int | str, num_output: int | str, chunk_overlap_ratio: float | str, @@ -83,7 +83,7 @@ def setup_service_context( Parameters ---------- - llm : LLM + llm : BaseLLM LLM to use to create the index vectors. max_input_size : int | str Context window size for the LLM. @@ -125,7 +125,8 @@ def setup_service_context( # initialise embedding model to use to create the index vectors embed_model = HuggingFaceEmbeddings( - model_name="sentence-transformers/all-mpnet-base-v2" + model_name="sentence-transformers/all-mpnet-base-v2", + encode_kwargs={"batch_size": 128}, ) # construct the prompt helper @@ -415,10 +416,16 @@ def _load_wikis(self, gh_token: str) -> None: Load in documents from the wikis. For 'wikis' index and 'all_data' index. + + Parameters + ---------- + gh_token : str + Github token to use to access the research-engineering-group + and Hut23 repo wikis. """ wiki_urls = [ - "https://github.com/alan-turing-institute/research-engineering-group.wiki.git", - "https://github.com/alan-turing-institute/Hut23.wiki.git", + f"https://oauth2:{gh_token}@github.com/alan-turing-institute/research-engineering-group.wiki.git", + f"https://oauth2:{gh_token}@github.com/alan-turing-institute/Hut23.wiki.git", ] for url in wiki_urls: @@ -689,13 +696,13 @@ def _get_response(self, msg_in: str, user_id: str) -> str: answer = formatted_response return answer - def _prep_llm(self) -> LLM: + def _prep_llm(self) -> BaseLLM: """ Method to prepare the LLM to be used. Returns ------- - LLM + BaseLLM LLM to be used. Raises @@ -896,7 +903,7 @@ def _prep_llm(self) -> OpenAI: class LlamaIndexGPTAzure(LlamaIndex): def __init__( - self, model_name: str = "reginald-gpt35-turbo", *args: Any, **kwargs: Any + self, model_name: str = "reginald-gpt4", *args: Any, **kwargs: Any ) -> None: """ `LlamaIndexGPTAzure` is a subclass of `LlamaIndex` that uses Azure's @@ -910,7 +917,7 @@ def __init__( Parameters ---------- model_name : str, optional - The deployment name of the model, by default "reginald-gpt35-turbo" + The deployment name of the model, by default "reginald-gpt4" """ openai_azure_api_base = get_env_var("OPENAI_AZURE_API_BASE", secret_value=False) if openai_azure_api_base is None: @@ -929,7 +936,7 @@ def __init__( self.openai_api_key = openai_azure_api_key self.openai_api_version = "2023-09-15-preview" self.temperature = 0.7 - super().__init__(*args, model_name="gpt-3.5-turbo", **kwargs) + super().__init__(*args, model_name="gpt-4", **kwargs) def _prep_llm(self) -> AzureOpenAI: logging.info(f"Setting up AzureOpenAI LLM (model {self.deployment_name})") @@ -941,5 +948,6 @@ def _prep_llm(self) -> AzureOpenAI: api_key=self.openai_api_key, api_base=self.openai_api_base, api_type="azure", + azure_endpoint=self.openai_api_base, api_version=self.openai_api_version, )