Catalog
gllm-inference | Tutorial: Catalog | API Reference
Installation
# you can use a Conda environment
pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/ gllm-inference# you can use a Conda environment
pip install --extra-index-url https://oauth2accesstoken:$(gcloud auth print-access-token)@glsdk.gdplabs.id/gen-ai-internal/simple/ gllm-inference# you can use a Conda environment
FOR /F "tokens=*" %T IN ('gcloud auth print-access-token') DO pip install --extra-index-url "https://oauth2accesstoken:%T@glsdk.gdplabs.id/gen-ai-internal/simple/" gllm-inferencePrompt Builder Catalog
Prompt Builder Catalog enables you to load and manage multiple prompt builders from various data sources like Google Sheets, CSV files, or Python records. This allows you to centralize prompt management, making it easier to maintain, version, and share prompts across your applications.
For example, instead of hard-coding prompts in your code, you can store them in a Google Sheet with names like "summarize", "transform_query", and "draft_document", then load them all at once using the catalog.
Catalog Configuration
The PromptBuilderCatalog can be configured using a table (such as a CSV file or Google Sheet), or directly from a list of Python dictionaries (records). To function correctly, the table or records must include specific columns or keys:
Required Columns:
name: The unique identifier for the prompt builder
system: The system template (instructions for the AI)
user: The user template (how user input is formatted)
Loading Catalog
Option 1: From Google Sheets
Obtain Worksheet ID and Credentials
From your Google Sheets URL, you can obtain:
sheet_id: between/d/and/editworksheet_id:0(usually0for the first sheet)
Obtain Google Service Account JSON Credentials
Follow these steps:
Load with .from_gsheets() method
Option 2: From CSV File
Download/create CSV file
Prepare a CSV file that contains your prompt catalog definitions. You can find an example here #template-format-references.
Load with .from_csv() method
Option 3: From Python Records
**Define the catalog**
Provide the records in the format of list of dictionaries. An example can be found below:
{% endstep %}
{% step %} Load using `
.from_records()` method
Using Catalog
Once loaded, you can access any prompt builder by its name:
LM Request Processor Catalog
LM Request Processor Catalog enables you to load and manage multiple LM request processors from various data sources like Google Sheets, CSV files, or Python records. This allows you to centralize the configuration of complete AI pipelines, including prompts, models, credentials, and output parsing in one place.
For example, instead of manually configuring each LM request processor with its model, credentials, and prompts, you can store all configurations in a Google Sheet and load them by name like "summarizer", "question_answerer", and "code_generator".
Think of it as:
LM Request Processor Catalog is like having a configuration management system for your AI pipelines, where each row defines a complete, ready-to-use AI processor.
Catalog Configuration
The LMRequestProcessorCatalog can be configured using a table (such as a CSV file or Google Sheet), or directly from a list of Python dictionaries (records). To function correctly, the table or records must include specific columns or keys:
Required Columns:
name: The unique identifier for the LM request processor
system_template: The system template for the prompt builder
user_template: The user template for the prompt builder
model_id: The model identifier for the LM invoker
credentials: Authentication credentials for the model
config: Additional configuration for the LM invoker (JSON format)
output_parser_type: Type of output parser to use
Loading Catalog
Option 1: From Google Sheets
Obtain Worksheet ID and Credentials
From your Google Sheets URL, you can obtain:
sheet_id: between/d/and/editworksheet_id:0(usually0for the first sheet)
Obtain Google Service Account JSON Credentials
Follow these steps:
Load with .from_gsheets() method
Option 2: From CSV File
Download/create CSV file
Prepare a CSV file that contains your LM request processor catalog definitions. You can find an example here #template-format-references.
Load with .from_csv() method
Option 3: From Python Records
Define the catalog
Provide the records in the format of list of dictionaries. An example can be found below:
Load using .from_records() method
Using Catalog
Once loaded, you can use the LM request processors directly:
Output
Last updated