XRequest
Import  | 
Sourcecomponents/x-request  | 
| Property | Description | Type | Default | Version | 
|---|---|---|---|---|
| baseURL | Base URL for the API request | string | - | - | 
| model | Model name, e.g., 'gpt-3.5-turbo' | string | - | - | 
| dangerouslyApiKey | 🔥 dangerouslyApiKey presents security risks. Detailed documentation on this can be found in Explanation | string | - | - | 
| fetch | Optional custom fetch function for making requests | fetch | - | - | 
type XRequestFunction<Input = Record<PropertyKey, any>, Output = Record<string, string>> = (params: XRequestParams & Input,callbacks: XRequestCallbacks<Output>,transformStream?: XStreamOptions<Output>['transformStream'],) => Promise<void>;
| Property | Description | Type | Default | Version | 
|---|---|---|---|---|
| model | The model to be used for generating responses. | string | - | - | 
| messages | An array of message objects, each containing a role and content. | Record<PropertyKey, any>[] | - | - | 
| stream | Indicates whether to use streaming for the response. | boolean | false | - | 
| Property | Description | Type | Default | Version | 
|---|---|---|---|---|
| onSuccess | Callback for successful. | (messages: Output[]) => void | - | - | 
| onError | Callback for error handling. | (error: Error) => void | - | - | 
| onUpdate | Callback for message updates. | (message: Output) => void | - | - | 
| transformStream | Optional transform function for processing stream data | XStreamOptions<Output>['transformStream'] | - | - | 
Status-  | 
Update Times0  |