Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
zavoraad committed Jan 4, 2024
1 parent ad9aef5 commit 5a16aaf
Show file tree
Hide file tree
Showing 20 changed files with 1,689 additions and 324 deletions.
65 changes: 65 additions & 0 deletions (Clone) code/ai_gateway.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Databricks notebook source
client.create_endpoint(
name="bedrock-anthropic-completions-endpoint",
config={
"served_entities": [
"external_model": {
"name": "claude-v2",
"provider": "aws-bedrock",
"task": "llm/v1/completions",
"aws_bedrock_config": {
"aws_region": GLD_AWS_REGION,
"aws_access_key_id": GLD_AWS_ACCESS_KEY_ID,
"aws_secret_access_key": GLD_AWS_SECRET_ACCESS_KEY,
"bedrock_provider": "anthropic"
}
}
]
}
)

# COMMAND ----------

pip install mlflow --upgrade

# COMMAND ----------

dbutils.library.restartPython()

# COMMAND ----------

GLD_AWS_REGION = 'x'
GLD_AWS_ACCESS_KEY_ID = 'y'
GLD_AWS_SECRET_ACCESS_KEY = 'z'

# COMMAND ----------

import mlflow.deployments

client = mlflow.deployments.get_deploy_client("databricks")

client.create_endpoint(
name="bedrock-anthropic-completions-endpoint",
config={
"served_entities": [
{
"external_model": {
"name": "claude-v2",
"provider": "aws-bedrock",
"task": "llm/v1/completions",
"aws_bedrock_config": {
"aws_region": GLD_AWS_REGION,
"aws_access_key_id": GLD_AWS_ACCESS_KEY_ID,
"aws_secret_access_key": GLD_AWS_SECRET_ACCESS_KEY,
"bedrock_provider": "anthropic"
}
}
}
]
}
)

# COMMAND ----------

token = dbutils.notebook.entry_point.getDbutils().notebook().getContext().apiToken().get()
dbutils.fs.put("file:///root/.databrickscfg", "[DEFAULT]\nhost=https://e2-demo-field-eng.cloud.databricks.com\ntoken=" + token, overwrite=True)
Loading

0 comments on commit 5a16aaf

Please sign in to comment.