Llm4sHttpClient

org.llm4s.http.Llm4sHttpClient
See theLlm4sHttpClient companion object

Abstraction for HTTP client to enable dependency injection and testing.

All methods accept timeout in milliseconds. Headers are passed as single-valued maps. The implementation never throws on non-2xx status codes — callers inspect HttpResponse.statusCode themselves.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def delete(url: String, headers: Map[String, String], timeout: Int): HttpResponse
def get(url: String, headers: Map[String, String], params: Map[String, String], timeout: Int): HttpResponse
def post(url: String, headers: Map[String, String], body: String, timeout: Int): HttpResponse
def postBytes(url: String, headers: Map[String, String], data: Array[Byte], timeout: Int): HttpResponse
def postMultipart(url: String, headers: Map[String, String], parts: Seq[MultipartPart], timeout: Int): HttpResponse
def postRaw(url: String, headers: Map[String, String], body: String, timeout: Int): HttpRawResponse

POST with a string body and return the response as raw bytes, bypassing charset decoding.

POST with a string body and return the response as raw bytes, bypassing charset decoding.

Use this when the response body is binary (e.g. image data) where decoding to a String and back would corrupt bytes that are not valid in the chosen charset.

Attributes

def postStream(url: String, headers: Map[String, String], body: String, timeout: Int): StreamingHttpResponse

POST with a string body and return the response as a streaming InputStream.

POST with a string body and return the response as a streaming InputStream.

Use this for server-sent events or JSON-lines endpoints where the body must be consumed incrementally. The caller is responsible for closing the InputStream.

Default timeout is 10 minutes to accommodate long-running streams.

Attributes

def put(url: String, headers: Map[String, String], body: String, timeout: Int): HttpResponse