///
import type { ChronicleChatRequestNonStreaming, ChronicleChatRequestStreaming, ChronicleChatResponseStream, ChronicleRequestOptions, ChronicleChatResponseNonStreaming, ChronicleRequestMetadata } from './types.js';
import { ChronicleEvent } from './events.js';
import EventEmitter from 'node:events';
export interface ChronicleClientOptions {
/** Replace the normal fetch function with this one */
fetch?: typeof fetch;
/** Set the url of the proxy. If omitted, the client will try to use the `CHRONICLE_PROXY_URL` environment variable,
* or default to http://localhost:9782. */
url?: string;
/** If the Chronicle proxy is behind a system that requires authentication, a bearer token to use. */
token?: string;
/** Set default options for requests made by this client. */
defaults?: Omit, 'signal'>;
}
export type NonStreamingClientFn = (chat: ChronicleChatRequestNonStreaming & Partial, options?: ChronicleRequestOptions) => Promise;
export type StreamingClientFn = (chat: ChronicleChatRequestStreaming & Partial, options?: ChronicleRequestOptions) => Promise;
export type ChronicleEventFn = (event: ChronicleEvent | ChronicleEvent[]) => Promise;
export type ChronicleClient = NonStreamingClientFn & StreamingClientFn & {
/** Send an event to Chronicle. All events will also be re-emitted from the client using the EventEmitter interface.
* where the event name is 'event' and the data is the event passed to this function. */
event: ChronicleEventFn;
/** Create a child client which shares the same settings and EventEmitter, but with new metadata merged
* over the existing metadata values. */
withMetadata: (newDefaults: ChronicleRequestMetadata) => ChronicleClient;
/** The request options used by this client. */
requestOptions: Partial;
} & EventEmitter<{
event: [ChronicleEvent];
}>;
/** Create a Chronicle proxy client. This returns a function which will call the Chronicle proxy */
export declare function createChronicleClient(options?: ChronicleClientOptions): ChronicleClient;
/** Initialize the default client with custom options. */
export declare function createDefaultClient(options: ChronicleClientOptions): ChronicleClient;
/** Return the default client, or create one if it doesn't exist. This is primarily
* used by the run auto-instrumentation functions. */
export declare function getDefaultClient(): ChronicleClient;
//# sourceMappingURL=client.d.ts.map