Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.1.0
2 changes: 1 addition & 1 deletion sdks/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@goreal-ai/plp-client",
"version": "1.2.0",
"version": "1.3.0",
"description": "Official JavaScript/TypeScript client for PLP (Prompt Library Protocol)",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand Down
156 changes: 156 additions & 0 deletions sdks/js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,74 @@ export interface ResolvedContext {
dataUrl: string | null;
}

// =============================================================================
// Deploy Types
// =============================================================================

export interface DeployRequest {
versionNo: number;
environment: string;
}

export interface DeployResponse {
promptId: string;
versionNo: number;
environment: string;
deployedAt: string;
}

// =============================================================================
// Evaluation Types
// =============================================================================

export interface RunEvalRequest {
evalContent: string;
versionNo?: number;
datasetId?: string;
}

export interface EvalSuiteResult {
suiteName: string;
status: 'pass' | 'fail' | 'error';
tests: EvalTestResult[];
summary: {
total: number;
passed: number;
failed: number;
durationMs: number;
};
}

export interface EvalTestResult {
name: string;
status: 'pass' | 'fail' | 'error';
assertions: AssertionResult[];
durationMs?: number;
error?: string;
}

export interface AssertionResult {
operator: string;
status: 'pass' | 'fail' | 'error';
expected?: string;
actual?: string;
message?: string;
}

export interface EvalDatasetCase {
name: string;
input: Record<string, unknown>;
expected?: string;
model?: string;
metadata?: Record<string, unknown>;
}

export interface EvalDataset {
id: string;
description?: string;
cases: EvalDatasetCase[];
}

// =============================================================================
// Discovery Types
// =============================================================================
Expand All @@ -117,6 +185,8 @@ export interface Discovery {
list: boolean;
search: boolean;
contextStore?: boolean;
deploy?: boolean;
evaluation?: boolean;
};
}

Expand Down Expand Up @@ -405,6 +475,92 @@ export class PLPClient {
return this.requestJson<PublishResponse>('POST', `/v1/prompts/${promptId}/publish`, body);
}

// ===========================================================================
// Deploy Methods
// ===========================================================================

/**
* Deploy a prompt version to a named environment
* @param promptId - The prompt identifier
* @param versionNo - The version number to deploy
* @param environment - Target environment (e.g., "staging", "production")
* @returns Deploy response with timestamp
*/
async deploy(
promptId: string,
versionNo: number,
environment: string
): Promise<DeployResponse> {
const body: DeployRequest = { versionNo, environment };
return this.requestJson<DeployResponse>(
'POST',
`/v1/prompts/${promptId}/deploy`,
body
);
}

// ===========================================================================
// Evaluation Methods
// ===========================================================================

/**
* Run an evaluation suite against a prompt
* @param promptId - The prompt identifier
* @param evalContent - The .eval file content (YAML format)
* @param options - Optional version and dataset references
* @returns Evaluation suite results
*/
async runEval(
promptId: string,
evalContent: string,
options?: { versionNo?: number; datasetId?: string }
): Promise<EvalSuiteResult> {
const body: RunEvalRequest = {
evalContent,
...options,
};
return this.requestJson<EvalSuiteResult>(
'POST',
`/v1/prompts/${promptId}/eval`,
body
);
}

/**
* Save or update an eval dataset
* @param promptId - The prompt identifier
* @param datasetId - The dataset identifier
* @param dataset - The dataset content
* @returns The saved dataset
*/
async saveDataset(
promptId: string,
datasetId: string,
dataset: EvalDataset
): Promise<EvalDataset> {
return this.requestJson<EvalDataset>(
'PUT',
`/v1/prompts/${promptId}/eval/datasets/${datasetId}`,
dataset
);
}

/**
* Retrieve an eval dataset
* @param promptId - The prompt identifier
* @param datasetId - The dataset identifier
* @returns The dataset
*/
async getDataset(
promptId: string,
datasetId: string
): Promise<EvalDataset> {
return this.request<EvalDataset>(
'GET',
`/v1/prompts/${promptId}/eval/datasets/${datasetId}`
);
}

// ===========================================================================
// Context Store Methods
// ===========================================================================
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "plp-client"
version = "1.0.0"
version = "1.1.0"
description = "Official Python client for PLP (Prompt Library Protocol)"
readme = "README.md"
requires-python = ">=3.9"
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/src/plp_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
get_text_content,
)

__version__ = "1.0.0"
__version__ = "1.1.0"
__all__ = [
"PLPClient",
"PLPError",
Expand Down
Loading