generated from databricks-industry-solutions/industry-solutions-blueprints
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zavoraad
committed
Jan 4, 2024
1 parent
ad9aef5
commit 5a16aaf
Showing
20 changed files
with
1,689 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.