Vancouver.PromptTest (Vancouver v0.3.0)

View Source

Conveniences for testing Vancouver prompts.

Summary

Functions

Asserts that the response was successful, and that audio content was returned.

Creates a valid request body for a prompt get request.

Gets the role of the prompt.

Asserts that the response was successful, and that image content was returned.

Asserts that the response was successful, and that text content was returned.

Functions

audio_response(conn)

@spec audio_response(Plug.Conn.t()) :: map()

Asserts that the response was successful, and that audio content was returned.

Examples

content = audio_response(conn)
assert content["data"] == "base64-audio-data"
assert content["mimeType"] == "audio/wav"

build_get_request(prompt_name, arguments)

@spec build_get_request(String.t(), map()) :: map()

Creates a valid request body for a prompt get request.

Examples

body = build_get_request("code_review", %{"code" => "def hello, do: "Hello, World!""})

get_role(conn)

@spec get_role(Plug.Conn.t()) :: binary() | nil

Gets the role of the prompt.

Examples

assert get_role(conn) == "user"

assert get_role(conn) == "assistant"

image_response(conn)

@spec image_response(Plug.Conn.t()) :: map()

Asserts that the response was successful, and that image content was returned.

Examples

content = image_response(conn)
assert content["data"] == "base64-image-data"
assert content["mimeType"] == "image/png"

text_response(conn)

@spec text_response(Plug.Conn.t()) :: String.t()

Asserts that the response was successful, and that text content was returned.

Examples

assert text_response(conn) == "Hello, world!"