XRequest
XRequest
Importimport { XRequest } from "@ant-design/x"; |
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 | (chunks: Output[]) => void | - | - |
| onError | Callback for error handling | (error: Error) => void | - | - |
| onUpdate | Callback for message updates | (chunk: Output) => void | - | - |
| onStream | Callback for stream controller | (abortController: AbortController) => void | - | - |
| transformStream | Optional transform function for processing stream data | XStreamOptions<Output>['transformStream'] | - | - |
Status- |
Update Times0 |
Status- |
Update Times0 |
baseURL: https://api.example.com/chat/v1
model: gpt-3.5-turbo
dangerouslyApiKey: Bearer sk-your-dangerouslyApiKey
Status- |
Update Times0 |
Status- |
Update Times0 |