Recipes
Create a Completion Application
Use this recipe to create a simple completion application
https://pypi.org/project/scale-egp/
# Prerequisite: pip install -U scale-egp
from scale_gp import SGPClient
from scale_gp.lib.application_builder import ApplicationBuilder
from scale_gp.types.completion_create_params import ModelParameters
from scale_gp.types.chat_completion_create_params import (
ModelParameters as ChatModelParameters,
MessageEgpAPIBackendServerAPIModelsEgpModelsUserMessage,
)
Fetch your API Key from: https://gp.scale.com/admin/api-key
Fetch your Account ID from: https://gp.scale.com/admin/accounts
All resources you interact with using this client will belong to this account.
Note: If you are using your own VPC-deployed version of Scale GP, you will have a different endpoint_url. For users of our multi-tenant platform, use https://gp.scale.com
client = SGPClient(api_key=api_key)
Follow the steps inside the recipe “Deploy and Execute a Model” to create a completion model deployment that we will use in our application
model_deployment = client.models.deployments.create(
model_instance_id=model_instance.id, name="Gemini-Pro Deployment", account_id=account_id
)
We will now use our gemini-pro completion model to create a simple completion application with the ApplicationBuilder helper. Once the application variant is created, it can be used for evaluations, generating report cards, and other benchmarking tasks available in the SGP SDK. The application can also be processed with an input to return a completion result.
builder = ApplicationBuilder(client)
builder.create_completion_application(account_id=account_id, application_name="test-app-builder",completion_model_id=model_deployment.id)
builder.process(query="what is the capital of Canada?")