Skip to content

remote / Exports / HttpClient

Class: HttpClient

Simple HTTP Client for Remote Communication

Table of contents

Constructors

Methods

Constructors

constructor

new HttpClient(config): HttpClient

Parameters

NameType
configHttpClientConfig

Returns

HttpClient

Defined in

client/http-client.ts:34

Methods

post

post<TData, TResponse>(endpoint, data): Promise<HttpResponse<TResponse>>

Send POST request with type safety

Type parameters

NameType
TDataextends DefaultRequestData
TResponseTResponse

Parameters

NameType
endpointstring
dataTData

Returns

Promise<HttpResponse<TResponse>>

Defined in

client/http-client.ts:42


get

get<TResponse>(endpoint): Promise<HttpResponse<TResponse>>

Send GET request with type safety

Type parameters

Name
TResponse

Parameters

NameType
endpointstring

Returns

Promise<HttpResponse<TResponse>>

Defined in

client/http-client.ts:60


chat

chat(messages, provider, model, tools?): Promise<ResponseMessage>

Execute chat request specifically

Parameters

NameType
messagesBasicMessage[]
providerstring
modelstring
tools?any[]

Returns

Promise<ResponseMessage>

Defined in

client/http-client.ts:75


chatStream

chatStream(messages, provider, model, tools?): AsyncGenerator<ResponseMessage, any, any>

Execute streaming chat request

Parameters

NameType
messagesBasicMessage[]
providerstring
modelstring
tools?any[]

Returns

AsyncGenerator<ResponseMessage, any, any>

Defined in

client/http-client.ts:134


validateConfig

validateConfig(): boolean

Validate configuration

Returns

boolean

Defined in

client/http-client.ts:279

Released under the MIT License.