Appearance
GenAI Studio ​
GenAI Studio is a comprehensive AI development platform that enables teams to build, test, and deploy AI-powered applications collaboratively. It bridges the gap between technical and non-technical users by providing both visual interfaces and programmatic access to AI capabilities. All models hosted by the Swiss AI Platform are available to be consumed directly within GenAI Studio.
Key Features ​
- Visual Workflow Builder: Create and modify AI workflows using drag-and-drop interfaces
- Prompt Engineering Tools: Design, test, and refine prompts with real-time feedback
- API Integration: Full programmatic access for developers and system integrations
- Version Control: Track changes to prompts, models, and orchestration logic
- Testing & Monitoring: Built-in tools to evaluate AI performance and reliability
- Document Processing: Upload and process documents for retrieval-augmented generation (RAG)
- Collaborative Workspaces: Shared environments where teams can work together seamlessly
Main Advantages ​
- No-Code/Low-Code Options: Business users can create AI solutions without programming
- Developer-Friendly: Full API access and IDE integration for technical teams
- Unified Platform: All AI development tools in one cohesive environment
- Swiss AI Platform Models: Direct access to all models hosted by the Swiss AI Platform (see Inference Endpoints for available models)
- Easy Deployment: Streamlined process to move from prototype to production
- Performance Insights: Clear visibility into how AI models are performing
Overview ​
GenAI Studio organizes the AI development lifecycle into two distinct but interconnected phases:
Build Phase - This is where you create your AI applications. Whether you're crafting prompts, building complex workflows, or implementing document search capabilities, the Build phase provides all the tools needed to bring your AI ideas to life. You can work visually through drag-and-drop interfaces or programmatically through APIs, depending on your preference and technical background.
Test & Deploy Phase - Once you've built your AI application, this phase ensures it works reliably in production. You can evaluate performance with comprehensive testing frameworks, choose appropriate metrics, deploy with proper version control, and monitor real-world usage. This phase transforms experimental prototypes into robust, scalable AI solutions.
Build ​
Prompt ​
Define and iterate on prompts across all open and closed source models.
Prompts serve as instructions that guide Large Language Models (LLMs) to generate desired responses. In GenAI Studio, prompts are dynamic templates that can incorporate variables, conditional logic, and function calls to create sophisticated AI interactions.
Creating Dynamic Prompts ​
GenAI Studio supports two types of prompt blocks for different complexity levels:
Rich Text Blocks - Ideal for straightforward variable substitution. Simply type {{ or / to access available variables through a dropdown menu. Perfect for most common use cases where you need to insert dynamic content into your prompts.

Jinja Blocks - Provides advanced templating capabilities for complex scenarios requiring conditional logic, loops, and data manipulation. For comprehensive Jinja syntax documentation, visit the official Jinja documentation.
Key Features ​
- Variable Substitution: Reference input variables using
{{variable_name}}syntax - Conditional Logic: Implement if/else statements for dynamic prompt behavior
- JSON Support: Access nested data structures and object properties
- Comments: Add non-token consuming notes using
{# comment #}syntax
Function Calling ​
Enable models to interact with external APIs and tools by defining functions within your prompts:
- Navigate to the messages section of the prompt.
- Scroll to the bottom, where you'll find an Add button.
- Click on the Add button and select Add Function from the options.
Define functions within your prompts:
- Name: Unique identifier for the function
- Description: Natural language explanation of the function's purpose
- Parameters: Input specifications with types and descriptions
When a model determines a function should be called, it returns structured JSON indicating which function to execute and with what parameters.
Enforcing Tool Calls ​
By default, the model decides whether to call a function based on the prompt context and user input. However, you can enforce tool calls using the Forced flag:
- After adding a function, locate the function configuration in the messages section.
- Find the Forced toggle or dropdown option in the function settings.
- Enable the Forced flag to require the model to always call this function.
When the Forced flag is enabled:
- The model must call the specified function, regardless of the user input
- This is useful for workflows that require structured data extraction or mandatory API calls
- The model will still generate appropriate arguments based on the input context

Known issue
For function calling, the force and strict flags cannot always be enforced. Their behavior depends on the selected model. If you rely on these flags, test the use case first and choose the most suitable model before consuming it in production.

Testing and Optimization ​
Use Scenarios to test different variable combinations and observe model outputs. GenAI Studio provides tools to preview compiled prompts and track token usage to optimize performance and costs.
INFO
Refer to the Vellum Documentation for more details.
Document Search & RAG ​
Implement semantic search and RAG pipelines.
GenAI Studio enables you to build powerful Retrieval-Augmented Generation (RAG) systems by uploading and indexing documents that can be queried by AI models. This capability allows your AI applications to access and reference specific information from your knowledge base.
Document Indexes ​
Document Indexes serve as organized collections of documents grouped by use case. For example, if you're building a customer support chatbot, you might create an index containing all your product documentation, FAQ files, and support articles. Follow the steps to create a document index 
Key characteristics of Document Indexes:
- Environment Isolation: Documents are scoped to specific environments, ensuring proper separation between development, staging, and production
- Searchable Collections: Group related documents for efficient semantic search
INFO
What's new: GenAI Studio now also supports "Advanced Chunking" strategy for document ingestion. This option leverages Docling together with VLM-based parsing to better process both structured and unstructured file formats, improving extraction from documents with complex layouts, tables, and visually organized content.
This is especially useful when standard text extraction is not sufficient. A more detailed explanation is provided later in the Chunking Strategies section.
Uploading Documents ​
GenAI Studio supports both manual uploads through the interface and programmatic uploads via API. Upload documents via UI is easy and intuitive, allowing you to drag and drop files directly into the interface. Follow instead this python script for programmatic uploads:
python
# make sure to have runned
# pip install vellum-ai
import os
from vellum.client import Vellum, VellumEnvironment
client = Vellum(
api_key=os.environ["VELLUM_API_KEY"],
environment=VellumEnvironment(
default="https://api.genai-studio.private.cloud.swisscom.ch,
predict="https://api.genai-studio.private.cloud.swisscom.ch",
documents="https://api.genai-studio.private.cloud.swisscom.ch",
)
)
with open("/path/to/your/file.txt", "rb") as f:
result = client.documents.upload(
contents=f,
label="Human-friendly label for your document",
add_to_index_names=["<index-name>"],
external_id="<your-external-id>",
keywords=[],
)To retrieve the VELLUM_API_KEY follow this guide. It is also possible to check the uploaded documents and the corresponding processed versions.
Supported File Formats ​
GenAI Studio processes multiple file types with automatic text extraction:
Text-based Files: .txt, .csv, .json, .doc, .docx, .xls, .xlsx, .pptx Visual Files: .pdf, .png, .jpg (processed using OCR technology)
Document Limits: Each document can be up to 25MB and 2.5M characters
Chunking Strategies ​
GenAI Studio automatically processes documents into searchable chunks using intelligent strategies:
Default settings of Standard Chunking
- Overlapping windows with sentence splitting
- 50% minimum overlap between chunks
- Maximum 1000 characters per chunk
- Suitable for most text-based documents
These parameters can be adjusted to optimize performance for specific document types and use cases.
Advanced Chunking Strategy ​
For documents with complex layouts or richer visual structure, GenAI Studio also provides an Advanced Chunking strategy. This option is especially useful for information-retrieval use cases built on PDFs, documents with clear section hierarchies, tables, and other semi-structured or unstructured formats where standard text extraction may lose important context.
To set it up in GenAI Studio, start by creating a new Document Index and select Advanced Chunking as the ingestion strategy during the index configuration flow.

INFO
Note on Chunk Character Limits: When using Advanced Chunking, the chunk character limit value is not directly applied by GenAI Studio. Instead, document chunking is handled by Docling during the ingestion process (as described in the sections below), which uses header-driven chunking based on the logical structure of your documents rather than fixed character windows.
Once the Document Index is configured, the usage experience remains the same as with any other index:
- Upload documents manually through the GenAI Studio UI, or
- Upload them programmatically through the Python SDK
- Query the index from the UI, through the API, or from Workflow Search Nodes as usual
In other words, the main difference is not in how customers interact with the index, but in how documents are processed behind the scenes.
Under the hood, GenAI Studio uses a Docling instance to process uploaded files and improve parsing quality before they are indexed.
For more unstructured formats, especially PDFs and visually organized documents, a Vision Language Model (VLM) is additionally leveraged to perform OCR and reconstruct the content into a cleaner, more readable representation. This helps preserve document structure more accurately and improves the quality of the extracted text made available for retrieval.
After ingestion, customers can inspect the processed output directly in GenAI Studio:
- Open the Documents section
- Select the relevant uploaded document
- Use the toggle available in the document view to display the processed version
This makes it easier to validate how the platform interpreted the original file and to confirm that the extracted content is suitable for downstream search and generation tasks.
Retrieving Processed Text via API ​
You can retrieve the processed text from uploaded documents programmatically. This is useful for automating document uploads to a document index and using the parsed text as input for workflows.
Step 1: Get document information and extract the index ID
First, retrieve the document details to find the document_to_document_indexes ID:
bash
curl -H "X-API-KEY: $VELLUM_API_KEY" \
https://api.genai-studio.private.cloud.swisscom.ch/v1/documents/{document_id}In the response, locate the document_to_document_indexes array. Each entry contains:
json
"document_to_document_indexes": [
{
"id": "string",
"environment_document_index_id": "string",
"document_index_id": "string",
"extracted_text_file_url": "string",
"processing_state": "string",
"indexing_state": "AWAITING_PROCESSING"
}
]The id field is the document_to_document_index_id you need. Before retrieving the processed text, ensure the indexing_state is INDEXED (other possible values: AWAITING_PROCESSING, QUEUED, INDEXING, FAILED).
For complete API reference, see the Vellum Documentation.
Step 2: Download the extracted text
Use the document_to_document_index_id to retrieve the processed text:
bash
curl -H "X-API-KEY: $VELLUM_API_KEY" \
https://api.genai-studio.private.cloud.swisscom.ch/v1/document-to-document-indexes/{document_to_document_index_id}/contentOptional: Download the original file
To download the original uploaded file instead of the processed text:
bash
curl -H "X-API-KEY: $VELLUM_API_KEY" \
https://api.genai-studio.private.cloud.swisscom.ch/v1/documents/{document_id}/contentAdvanced Chunking also improves how the content is split into chunks. Instead of relying primarily on generic window-based chunking, this strategy is header-driven. Docling detects the logical headers and section boundaries in your documents and uses them to split content more intelligently. This means chunks are more likely to stay aligned with the original semantic structure of the document, reducing the risk of losing important context across section boundaries.
Simulating Searches on Document Indexes ​
Once documents are uploaded to a document index, GenAI Studio allows you to simulate searches to evaluate how effectively the system retrieves relevant chunks. This simulation helps refine search parameters and optimize retrieval performance.
Search simulations can be conducted either through the GenAI Studio UI or programmatically via the API.
You can configure the following parameters for a search:
- Search Query: Define the query text to retrieve relevant chunks from the indexed documents.
- Keyword vs Semantic Search Weight: Adjust the balance between keyword-based matching and semantic search to prioritize specific retrieval strategies.
- Number of Chunks to Return: Specify the maximum number of document chunks to retrieve for each query.
- Overlapping Policy: Set rules for how retrieved chunks overlap to ensure context continuity.
Using the UI:
The interface provides an intuitive way to test search queries. Simply input your query, adjust the parameters, and view the retrieved chunks directly within the platform. 
Using the API:
For programmatic access, use the following Python snippet to simulate searches:
python
# make sure to have runned
# pip install vellum-ai
import os
from vellum.client import Vellum, VellumEnvironment
client = Vellum(
api_key=os.environ["VELLUM_API_KEY"],
environment=VellumEnvironment(
default="https://api.genai-studio.private.cloud.swisscom.ch",
predict="https://api.genai-studio.private.cloud.swisscom.ch",
documents="https://api.genai-studio.private.cloud.swisscom.ch",
)
)
result = client.search(
index_name="<index-name>",
query="<your-query-here>",
options=SearchRequestOptionsRequest(
limit=6,
weights=SearchWeightsRequest(
semantic_similarity=0.65,
keywords=0.35,
),
result_merging=SearchResultMergingRequest(
enabled=True,
),
),
)To retrieve the VELLUM_API_KEY follow this guide.
INFO
Refer to the Vellum Documentation for more details.
Workflows ​
Build advanced AI systems like agents, chatbots, data extraction pipelines.
GenAI Studio Workflows enable you to create sophisticated multi-step AI applications through a visual, low-code interface. Whether you're building conversational agents, data processing pipelines, or complex decision trees, Workflows provide the tools to prototype, test, and deploy AI systems that combine multiple models and business logic.
Core Benefits ​
- Visual Development: Design complex AI flows using drag-and-drop interfaces
- Rapid Prototyping: Test different approaches quickly with immediate feedback
- Version Control: Track changes and manage different versions of your workflows
- Scalable Deployment: Deploy workflows as APIs for integration with your applications
- Comprehensive Monitoring: Monitor performance and debug issues with detailed execution logs
Key Concepts ​
Input Variables Define the dynamic inputs your workflow needs to function. For example, a customer service workflow might have input variables for customer_query, user_id, and conversation_history. These variables make your workflows flexible and reusable across different scenarios.
Scenarios Create test cases by assigning specific values to your input variables. Scenarios allow you to validate that your workflow behaves correctly across different conditions. You can define multiple scenarios and switch between them during development to ensure robust performance.
Nodes Nodes represent individual steps in your workflow, here the most relevant ones:
- Prompt Nodes: Invoke Large Language Models with customized instructions
- Search Nodes: Query document indexes for relevant information
- Templating Nodes: Generate dynamic content using templates
- API Nodes: Integrate with external services and systems
- Code Nodes: Execute custom Python or JavaScript logic
INFO
Refer to the Vellum Documentation for more details.
Edges Edges connect nodes and define the execution flow of your workflow. They determine the order in which actions are performed and how data flows between different steps. Each node has access to outputs from all upstream nodes, not just directly connected ones.
Final Outputs Final Output Nodes specify which data should be returned as the workflow's result. When you deploy a workflow as an API, only data from Final Output Nodes is returned by default. You can have multiple Final Output Nodes with different names to return structured results.
Prompt Nodes ​
Prompt Nodes invokes Large Language Models with customized instructions. These nodes provide access to all models available through the Swiss AI Platform
Configuration Options
When creating a Prompt Node, you can:
- Import Existing Prompts: Use prompts from previously created deployments or sandboxes
- Create New Prompts: Build prompts from scratch directly within the workflow
- Select Models: Choose from the full range of models available through the Swiss AI Platform
- Configure Parameters: Adjust settings like temperature, max output tokens, and other model-specific parameters
- Function Calling: Enable structured outputs by defining functions that compatible models can invoke
Variable Integration
Prompt Nodes seamlessly integrate with data from upstream nodes in your workflow. You can reference outputs from previous steps as variables within your prompts, creating dynamic and context-aware AI interactions.


Search Nodes ​
Search Nodes connect to Document Indexes you've created in GenAI Studio, allowing your workflows to access your organization's knowledge base. They respect environment boundaries, ensuring that searches only return documents from the same environment context as the workflow execution.
Configuration Options
When setting up a Search Node, you can configure:
- Document Index Selection: Choose from existing indexes or dynamically select based on upstream node outputs
- Search Query: Define the search terms, often using variables from previous workflow steps
- Result Limits: Specify the number of document chunks to return
- Search Weights: Balance between semantic similarity and keyword matching
- Result Merging: Control how overlapping document chunks are handled
Dynamic Index Selection
Search Nodes support both static and dynamic index selection:
- Static Selection: Choose a specific Document Index for all workflow executions
- Dynamic Selection: Use outputs from upstream nodes to determine which index to search, enabling user-specific or context-specific document retrieval
This flexibility is particularly valuable when you need to separate content across different user groups or organizational departments.
Metadata Filtering
Advanced filtering capabilities allow you to narrow search results based on document metadata. For example, you can restrict searches to documents with specific department, policy_type, or date_range attributes, ensuring users only access relevant information.


Templating Nodes ​
Templating Nodes use Jinja2 templating syntax to transform data, allowing you to:
- Define constants and computed values
- Manipulate data before prompt processing
- Format responses to specific requirements
- Perform conditional data transformations
Configuration Options
When setting up a Templating Node, you can:
- Define Input Variables: Specify which upstream node outputs to use as inputs
- Write Jinja Templates: Create custom transformations using Jinja2 syntax
- Test Transformations: Preview outputs with different input scenarios
- Set Output Names: Define how the transformed data will be referenced downstream
Common Use Cases
String Manipulation Truncate text to fit context windows, extract substrings, or format text for specific requirements:
jinja
{{ user_input[:100] }} {# First 100 characters #}JSON Processing Validate and manipulate JSON data from LLM responses or external APIs:
jinja
{% if response|is_valid_json_string %}
{{ json.loads(response).key }}
{% else %}
{{ "Invalid JSON" }}
{% endif %}Chat History Management Process conversation history for long-running chatbots by limiting context:
jinja
{{ chat_history[-5:] }} {# Last 5 messages #}Search Result Formatting Transform search results to include source citations and structured formatting:
jinja
{% for result in search_results -%}
Source: {{ result.document.label }}
Content: {{ result.text }}
{% if not loop.last %}#####{% endif %}
{% endfor %}Best Practices
- XML Tags for LLMs: Use XML tags to help models identify content boundaries, which can significantly improve performance
- Whitespace Management: Use Jinja's whitespace control (
{%-and-%}) to avoid unexpected spacing issues - JSON Formatting: Always use double quotes when working with JSON output to ensure validity

API Nodes ​
API Nodes invoke HTTP endpoints and return structured responses including status codes, raw output, and parsed JSON data when applicable. They support both publicly accessible APIs and private backend services through secure authentication mechanisms.
Configuration Options
When setting up an API Node, you can configure:
- HTTP Methods: Support for standard methods including GET, POST, PUT, DELETE, PATCH, and more
- Request URLs: Static URLs or dynamic URLs using variables from upstream nodes
- Request Body: JSON payloads, form data, or raw content for POST/PUT requests
- Headers: Custom headers for API requirements and content type specification
- Authentication: Multiple authentication types including Bearer tokens, API keys, and custom headers
- Timeout Settings: Maximum request duration to prevent workflow blocking


Code Nodes ​
Code Nodes execute custom code with access to upstream node outputs as function parameters. They enable developers to implement sophisticated algorithms, data transformations, and business logic while maintaining the visual workflow structure.
Code Structure Requirements
All Code Nodes must include a main() function that serves as the entry point. The function parameters must exactly match the input variable names defined in your node:
python
def main(input_text, user_data):
# Your custom logic here
processed_text = input_text.upper()
result = {
"processed": processed_text,
"user_id": user_data.get("id", "unknown")
}
return resultSupported Languages
GenAI Studio Code Nodes support:
- Python: Full Python standard library with access to popular packages
- TypeScript: Modern JavaScript with type safety and enhanced tooling
Configuration Options
When setting up a Code Node, you can:
- Define Input Parameters: Specify which upstream node outputs to use as function inputs
- Write Custom Logic: Implement business rules, data processing, or integrations
- Import Packages: Use standard libraries and popular third-party packages
- Return Structured Data: Output JSON objects, arrays, or primitive types for downstream nodes
Known issue
When Python libraries or packages are included in a Code Node, some workflow runs can fail because of a timeout. This timeout is due to building time of the Docker image. Issue is expected to be fixed in the next releases.
Common Use Cases
Data Processing and Transformation Implement complex data manipulation that requires custom logic beyond templating:
python
def main(search_results, user_preferences):
# Custom ranking algorithm
scored_results = []
for result in search_results:
score = calculate_relevance_score(result, user_preferences)
scored_results.append({
"content": result["text"],
"score": score,
"source": result["document"]["label"]
})
# Sort by score and return top 3
return sorted(scored_results, key=lambda x: x["score"], reverse=True)[:3]Business Logic Implementation Execute domain-specific business rules and validation:
python
def main(user_request, user_profile):
# Implement approval logic
if user_profile["role"] == "admin":
approval_status = "auto_approved"
elif user_request["amount"] < 1000:
approval_status = "auto_approved"
else:
approval_status = "requires_approval"
return {
"status": approval_status,
"next_step": get_next_action(approval_status),
"approver": get_required_approver(user_request) if approval_status == "requires_approval" else None
}External System Integration Process data for external API calls or handle responses:
python
import json
import datetime
def main(api_response, request_context):
# Parse and validate API response
try:
data = json.loads(api_response) if isinstance(api_response, str) else api_response
# Transform for downstream processing
result = {
"success": True,
"processed_at": datetime.datetime.now().isoformat(),
"data": transform_api_data(data),
"context": request_context
}
except Exception as e:
result = {
"success": False,
"error": str(e),
"raw_response": api_response
}
return resultChat History Processing Implement sophisticated conversation management:
python
def main(chat_history, current_message):
# Analyze conversation patterns
message_count = len(chat_history)
recent_topics = extract_topics(chat_history[-5:])
sentiment_trend = analyze_sentiment_trend(chat_history)
return {
"context_summary": f"Conversation with {message_count} messages",
"recent_topics": recent_topics,
"sentiment": sentiment_trend,
"should_escalate": sentiment_trend == "declining" and message_count > 5
}

Copying workflows between workspaces or orgs ​
GenAI Studio workflows can also be copied from one workspace or organization to another through the Vellum CLI. This procedure is useful when a workflow should be recreated in another environment while preserving the sandbox definition.
The required Python package is vellum-ai:
bash
pip install vellum-aiPrerequisites ​
Before starting the copy procedure, make sure the following items are available:
- A
VELLUM_API_KEYfor the source workspace or organization - A
VELLUM_API_KEYfor the target workspace or organization - Access to the workflow sandbox in the GenAI Studio UI
- The
jqutility to updatevellum.lock.json
Pull the workflow from the source workspace or org ​
First, configure the CLI to point to the source environment:
bash
export VELLUM_API_URL=https://api.genai-studio.private.cloud.swisscom.ch
export VELLUM_API_KEY="api key of vellum for the workspace/org where to pull the workflow from"Then retrieve the pull command directly from the workflow sandbox:
- Open the workflow sandbox in the GenAI Studio UI.
- Navigate to the code preview section.
- Copy the CLI pull command shown there.
The command will look similar to the following example:
bash
vellum workflows pull --workflow-sandbox-id=5aeb583c-677f-4cbd-b195-243a04414c13 --include-sandboxRun the command in the local project directory. This will pull the workflow definition and generate the corresponding vellum.lock.json content locally.
Push the workflow to the target workspace or org ​
Switch the CLI configuration to the target environment:
bash
export VELLUM_API_URL=https://api.genai-studio.private.cloud.swisscom.ch
export VELLUM_API_KEY="secret of org/workspace to push the workflow"Then prepare the target sandbox:
- Create a new workflow in the target GenAI Studio UI.
- Retrieve the new workflow sandbox ID. In this example, the ID is
0b8d74e5-a00c-452f-a2f5-423b1a1bfa5c. - Replace the pulled sandbox ID in
vellum.lock.jsonwith the new target sandbox ID:
bash
jq '.workflows[0].workflow_sandbox_id="0b8d74e5-a00c-452f-a2f5-423b1a1bfa5c"' vellum.lock.json > tmp && mv tmp vellum.lock.jsonAs with the pull command, the push command can be copied from the UI code preview of the target workflow. It will look similar to the following example:
bash
vellum workflows push --workflow-sandbox-id=0b8d74e5-a00c-452f-a2f5-423b1a1bfa5c --include-sandboxRun the push command to upload the local workflow definition into the target workspace or organization.
INFO
To retrieve a VELLUM_API_KEY, refer to the API Key creation section.
WARNING
The workflow needs to exist already in the target workspace or organization before the workflow_sandbox_id is replaced in vellum.lock.json. The exact pull and push commands should always be copied from the GenAI Studio UI, because the sandbox ID is workflow-specific.
Deploy & Test ​
Deployment ​
A Deployment represents a specific Prompt or Workflow that can be invoked via API. There are several client SDKs to consume a GenAI Studio workflow, refer to the SDK documentation for more details.
Workflow Deployment ​
Follow these steps to deploy the workflow. 
Here a snippet to consume the deployed workflow:
python
# make sure to have runned
# pip install vellum-ai
import os
from vellum.client import Vellum, VellumEnvironment
client = Vellum(
api_key=os.environ["VELLUM_API_KEY"],
environment=VellumEnvironment(
default="https://api.genai-studio.private.cloud.swisscom.ch",
predict="https://api.genai-studio.private.cloud.swisscom.ch",
documents="https://api.genai-studio.private.cloud.swisscom.ch",
)
)
result = client.execute_workflow(
workflow_deployment_name="<workflow-name>",
release_tag="LATEST",
inputs=[
types.WorkflowRequestChatHistoryInputRequest(
name="chat_history",
type="CHAT_HISTORY",
value=[
types.ChatMessageRequest(role="USER", text="<example-user-text>")
],
),
],
)
if result.data.state == "REJECTED":
raise Exception(result.data.error.message)
print(result.data.outputs)API Key creation ​
To retrieve a VELLUM_API_KEY, follow these steps:

Testing & Evaluation ​
Ensuring model quality is challenging, because prompts need to work effectively and consistently over a wide range of potential inputs. When modifying a Prompt, adjusting parameters, or switching models, the likelihood of regression is high. This is where quantitative evaluation becomes essential.
GenAI Studio's answer to quantitative evaluation are Test Suites and Metrics. Unlike manual testing where the output of each scenario is qualitatively evaluated by visual inspection, Test Suites use Metrics that return scores between 0 and 1 to provide a more objective measure of quality over a wider range of scenarios. This is especially important when your prompt's coverage needs scale and visual inspection is no longer feasible, which typically happens when you have 10+ scenarios.
Test Suites Overview ​
Test Suites cover common use cases in AI development:
- Test Driven Development of Prompts/Workflows in a Sandbox
- Performance Testing on large numbers of scenarios
- Regression Testing before deploying changes to production
- External Entity Evaluation for functions hosted outside GenAI Studio
You can create standalone Test Suites through the Test Suites page in the Evaluations tab, or create Test Suites starting from a Prompt or Workflow Sandbox.
From a Prompt Sandbox:
- From your Prompt Sandbox, click on the "Evaluations" sub-tab
- Click "Create New Test Suite" or the "Add Test Suite" button
- The "label" and "name" fields are autopopulated with your Sandbox name
- Review the "Interface Configuration" showing expected inputs/outputs
- Click "Add Metric" to select evaluation metrics
- Choose from available metrics like "Exact Match", "JSON Validity", or create custom metrics (recommended)
- Map the metric inputs to your prompt outputs
- Define expected output variables for comparison

Test Case Creation:
Test Cases are analogous to Scenarios. Each Test Case contains:
- Input variables for your prompt or workflow
- Expected output variables for metric comparison
- Labels for easy identification and organization
You can initialize Test Cases in several ways:
- Start from Scenarios: Import existing scenarios from your Sandbox
- Manual Creation: Add test cases individually through the interface
- CSV Upload: Bulk upload test cases from CSV files
- API Integration: Programmatically create test cases via API
Once your Test Suite is configured, you can run evaluations:
- Navigate to your Prompt or Workflow Sandbox
- Click "Add Test Suite" to attach an existing Test Suite
- Press the "Run" button to execute all test cases
- Review results with detailed score breakdowns
Metrics ​
GenAI Studio provides evaluation capabilities through both reference metrics and custom metric creation tools. While default metrics demonstrate evaluation concepts, production deployments should use custom metrics.
WARNING
Important: The default metrics shown below are provided as mockup examples and inspiration only. They assume interaction with external LLM providers and are not functional in the current GenAI Studio deployment.
Working out-of-the-box: Latency, Word Count Adherence, JSON Validity, Regex Match, and Exact Match.
The recommended approach is to create custom metrics tailored to your evaluation needs. See the Custom Metrics section for guidance on building production-ready evaluation workflows.
Core Evaluation Metrics ​
Exact Match Check that the output is exactly equal to the target value.
- Score Range: Binary (0 or 1)
- Returns: 1 if the output is an exact match, 0 otherwise
- Use Cases:
- Validating specific format requirements
- Ensuring precise compliance with structured outputs
- Testing deterministic responses
python
# Example: Testing exact match for classification
test_case = {
"input": "Classify sentiment: 'I love this product!'",
"expected_output": "positive",
"actual_output": "positive" # Score: 1.0
}Regex Match Check that a specified regular expression pattern can be found in the output.
- Score Range: Binary (0 or 1)
- Returns: 1 if the regular expression matches, 0 otherwise
- Pattern Matching: Unless explicitly anchored, matches anywhere in the output
- Use Cases:
- Validating format patterns (emails, phone numbers, IDs)
- Checking for required keywords or phrases
- Ensuring structured data compliance
python
# Example: Validating email format in output
regex_pattern = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
test_case = {
"input": "Extract email from: 'Contact us at support@company.com'",
"pattern": regex_pattern,
"actual_output": "support@company.com" # Score: 1.0
}JSON Validity Check that the output is valid, parseable JSON.
- Score Range: Binary (0 or 1)
- Returns: 1 if the output is valid JSON, 0 otherwise
- Use Cases:
- Validating structured data outputs
- Ensuring API response compatibility
- Testing function calling outputs
python
# Example: JSON validity check
test_case = {
"input": "Generate user profile as JSON",
"actual_output": '{"name": "John", "age": 30, "active": true}' # Score: 1.0
}Custom Metrics ​
Recommended Approach for Production: Create custom metrics tailored to your specific evaluation requirements. GenAI Studio supports reusable custom metrics for domain-specific evaluation requirements. These metrics can be created once and reused across multiple Test Suites for prompts, workflows, or external entities.
Create Your First Reusable Metric
- Open the Evaluations tab and go to the Metrics page.
- Click Create Metric.
- Select the metric type you want to use, for example JSON Schema Match.
- Enter a Label and Description. The Name field is automatically generated and can be used as a unique identifier.
- Click Next and configure the evaluation logic.
- Finish the setup and save the metric.
Once created, the metric becomes available when configuring any Test Suite.
Available Metric Types
- JSON Schema Match: Checks whether the output matches a specified JSON schema. Returns
1if the schema matches and0otherwise. - Workflow: Runs a GenAI Studio Workflow to evaluate the output. This is useful when the scoring logic itself should be modeled as a workflow.
- Code Execution: Runs custom Python or TypeScript code to score the output.
Code Execution Metrics
Code Execution Metrics are useful when you need custom parsing, conditional logic, or exact business-specific validation that is not covered by built-in metrics.
The code must expose a main() function and return an object containing at least a score field.
python
import json
def main(
completion: str,
target: str,
) -> dict:
"""Produces a dict containing at least a 'score' key with a numerical value."""
completion_dict = json.loads(completion)
target_dict = json.loads(target)
is_equal = completion_dict == target_dict
return {
"score": 1.0 if is_equal else 0.0,
}For more advanced implementations, you can also add external Python or TypeScript packages. Package versions must be pinned explicitly, and the required imports must be included in your code.
Workflow Metrics
Workflow Metrics let you use a GenAI Studio Workflow to evaluate outputs. This is especially useful when simple matching rules are not enough and you want an evaluator that can apply a rubric, return a rationale, or combine several checks into a single score.
Common patterns include:
- Per-test-case rubric: pass a different scoring instruction for each test case.
- Fixed-purpose metrics: create multiple reusable metrics, each focused on a single quality criterion.
To create a Workflow Metric:
- Create a new Agent.
- Add one input variable for each value you want to pass from the Test Suite.
- Create a final output named
scoreand set its type to Number. - Optionally add outputs such as
rationaleorsummaryfor debugging and traceability. - Implement the evaluation logic in the workflow.
- Deploy the workflow.
- Create the reusable metric and select the deployed evaluation workflow as its scoring logic.
- Open the target prompt or workflow that you want to evaluate.
- In the Evaluations section, add the metric you just created and map its inputs to the outputs and variables of the target prompt or workflow.
INFO
For detailed information on creating custom metrics and advanced evaluation strategies, refer to the Vellum documentation.
Monitoring ​
GenAI Studio provides comprehensive monitoring capabilities for your deployed AI applications, enabling you to track performance trends, identify issues, and optimize your systems in production. All request-level data from your deployments can be monitored in aggregate through intuitive dashboards and visualizations.
Number of Completions: Number of requests made against the Generate endpoint
Average Quality over Time: Quality tracked for each completion. This is only visible if Quality is filled out either through the UI or Actuals Endpoint API
Number of Completions w/ Actuals Submitted: Number of requests that have an associated quality / Actuals indication
Average Latency Over Time: Time taken for the request to complete
Num LLM Provider Errors Over Time: Number of errors from the LLM provider
INFO
For detailed information on setting up custom monitoring dashboards and advanced alerting configurations, refer to the Vellum Documentation.
Reaching external sources ​
GenAI Studio deployments run in a secure, isolated environment without direct internet access. To enable your AI applications to interact with external systems, GenAI Studio provides the possibility to whitelist specific external endpoints by adding them to a proxy allowlist.
Possible scenarios where external access is required include:
- Calling external APIs from within Workflow API Nodes
- Adding external MCP servers to your workflows
- Accessing third-party services for data enrichment or validation
To enable external access for your deployments, please contact us at Platform.AI@swisscom.com or raise a support ticket through our wiki form. Please include the following information in your request:
- External endpoints (domains or IP addresses) to whitelist
- Tenant and environment where the allowlist should be applied
- Use case description and justification for external access
