Files
sdk/docs/PromptAPI.md

11 KiB

\PromptAPI

All URIs are relative to https://api.hanzo.ai

Method HTTP request Description
DeletePromptByName Delete /v1/prompt/{name} Delete removes one of the caller org's prompts and every version of it, answering 204.
GetPrompt Get /v1/prompt Returns the caller org's prompt library as one row per prompt: its name, type, every version number it has, its taxonomy and when it last changed.
GetPromptByName Get /v1/prompt/{name} Returns one of the caller org's prompts: its CURRENT template text plus the metadata of every version it has had.
GetPromptCatalog Get /v1/prompt/catalog Returns the read-only starter prompt library shipped with the binary — reference content every tenant sees the same, NOT the caller's own prompts and never mixed into them.
GetPromptMetrics Get /v1/prompt/metrics Returns real per-prompt statistics for the caller's org: how many versions each prompt has, which one is current, and when it was created and last changed.
PostPrompt Post /v1/prompt Records a prompt for the caller's org and answers 201 with it.

DeletePromptByName

DeletePromptByName(ctx, name).Execute()

Delete removes one of the caller org's prompts and every version of it, answering 204.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	name := "greeting" // string | Name is the prompt to act on, from the path.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	r, err := apiClient.PromptAPI.DeletePromptByName(context.Background(), name).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PromptAPI.DeletePromptByName``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string Name is the prompt to act on, from the path.

Other Parameters

Other parameters are passed through a pointer to a apiDeletePromptByNameRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetPrompt

PromptPromptList GetPrompt(ctx).Execute()

Returns the caller org's prompt library as one row per prompt: its name, type, every version number it has, its taxonomy and when it last changed.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.PromptAPI.GetPrompt(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PromptAPI.GetPrompt``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetPrompt`: PromptPromptList
	fmt.Fprintf(os.Stdout, "Response from `PromptAPI.GetPrompt`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetPromptRequest struct via the builder pattern

Return type

PromptPromptList

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetPromptByName

PromptPromptDetail GetPromptByName(ctx, name).Execute()

Returns one of the caller org's prompts: its CURRENT template text plus the metadata of every version it has had.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	name := "greeting" // string | Name is the prompt to act on, from the path.

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.PromptAPI.GetPromptByName(context.Background(), name).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PromptAPI.GetPromptByName``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetPromptByName`: PromptPromptDetail
	fmt.Fprintf(os.Stdout, "Response from `PromptAPI.GetPromptByName`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
name string Name is the prompt to act on, from the path.

Other Parameters

Other parameters are passed through a pointer to a apiGetPromptByNameRequest struct via the builder pattern

Name Type Description Notes

Return type

PromptPromptDetail

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetPromptCatalog

PromptCatalogList GetPromptCatalog(ctx).Execute()

Returns the read-only starter prompt library shipped with the binary — reference content every tenant sees the same, NOT the caller's own prompts and never mixed into them.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.PromptAPI.GetPromptCatalog(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PromptAPI.GetPromptCatalog``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetPromptCatalog`: PromptCatalogList
	fmt.Fprintf(os.Stdout, "Response from `PromptAPI.GetPromptCatalog`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetPromptCatalogRequest struct via the builder pattern

Return type

PromptCatalogList

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetPromptMetrics

PromptMetricList GetPromptMetrics(ctx).Execute()

Returns real per-prompt statistics for the caller's org: how many versions each prompt has, which one is current, and when it was created and last changed.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.PromptAPI.GetPromptMetrics(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PromptAPI.GetPromptMetrics``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetPromptMetrics`: PromptMetricList
	fmt.Fprintf(os.Stdout, "Response from `PromptAPI.GetPromptMetrics`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetPromptMetricsRequest struct via the builder pattern

Return type

PromptMetricList

Authorization

bearer

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostPrompt

PromptPromptDetail PostPrompt(ctx).PromptPromptReq(promptPromptReq).Execute()

Records a prompt for the caller's org and answers 201 with it.

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/hanzoai/go-sdk/v8"
)

func main() {
	promptPromptReq := *openapiclient.NewPromptPromptReq() // PromptPromptReq | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.PromptAPI.PostPrompt(context.Background()).PromptPromptReq(promptPromptReq).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PromptAPI.PostPrompt``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `PostPrompt`: PromptPromptDetail
	fmt.Fprintf(os.Stdout, "Response from `PromptAPI.PostPrompt`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiPostPromptRequest struct via the builder pattern

Name Type Description Notes
promptPromptReq PromptPromptReq

Return type

PromptPromptDetail

Authorization

bearer

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/problem+json

[Back to top] [Back to API list] [Back to Model list] [Back to README]