org.llm4s.http

package org.llm4s.http

Members list

Type members

Classlikes

@Stable
object HttpHeaders

Case-insensitive lookup over a multi-valued header map, as carried by every response type in this package.

Case-insensitive lookup over a multi-valued header map, as carried by every response type in this package.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
@Stable
case class HttpRawResponse(statusCode: Int, body: Array[Byte], headers: Map[String, Seq[String]])

HTTP response wrapper for binary (non-text) response bodies.

HTTP response wrapper for binary (non-text) response bodies.

Use this instead of HttpResponse when the response body is binary data (e.g. image bytes) to avoid lossy charset decoding.

Value parameters

body

Raw response bytes — exact wire representation, no charset conversion

headers

Response headers as a multi-valued map (lowercase keys)

statusCode

HTTP status code

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
@Stable
case class HttpResponse(statusCode: Int, body: String, headers: Map[String, Seq[String]])

HTTP response wrapper exposing status code, body, and headers.

HTTP response wrapper exposing status code, body, and headers.

Value parameters

body

Response body as a string

headers

Response headers as a multi-valued map (lowercase keys)

statusCode

HTTP status code (e.g. 200, 404)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object HttpResponse

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
@Stable
final case class JsonHttpResponse(statusCode: Int, body: Value, headers: Map[String, Seq[String]])

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
@Stable
trait Llm4sHttpClient extends AutoCloseable

The HTTP client provider modules and built-in tools use, abstracted so it can be injected and replaced by a test double.

The HTTP client provider modules and built-in tools use, abstracted so it can be injected and replaced by a test double.

Every request method returns a Result and never throws for a transport failure:

A non-2xx status is '''not''' an error at this layer: it is a Right response, which the caller inspects (HttpResponse.ensureSuccess, or org.llm4s.llmconnect.provider.HttpErrorMapper.mapHttpError with the response headers).

Headers are passed as single-valued maps. Response headers are multi-valued, keyed in lower case; look one up with header(name).

The trait is deliberately not sealed, so tests can implement it. Methods added to it after 1.0 will have default implementations, so a test double keeps compiling.

Attributes

Companion
object
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
@Stable
sealed trait MultipartPart

Represents a single part in a multipart/form-data request.

Represents a single part in a multipart/form-data request.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class FilePart
class TextField
object MultipartPart

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
@Stable
case class StreamingHttpResponse(statusCode: Int, body: InputStream, headers: Map[String, Seq[String]])

HTTP response wrapper for streaming (InputStream-based) response bodies.

HTTP response wrapper for streaming (InputStream-based) response bodies.

Use this instead of HttpResponse when the response body must be consumed incrementally (e.g. server-sent events, JSON lines).

Value parameters

body

Response body as an InputStream — caller is responsible for closing it, on error statuses too

headers

Response headers as a multi-valued map (lowercase keys)

statusCode

HTTP status code

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all