Vancouver.PromptTest (Vancouver v0.3.0)
View SourceConveniences 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
@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"
Creates a valid request body for a prompt get request.
Examples
body = build_get_request("code_review", %{"code" => "def hello, do: "Hello, World!""})
@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"
@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"
@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!"