useXAgent
Used for model scheduling with Agent hooks.
Import
|
Sourcecomponents/use-x-agent |
Import
|
Sourcecomponents/use-x-agent |
Connect with the backend model to provide an abstract data flow.
type useXAgent<AgentMessage> = (config: XAgentConfigPreset | XAgentConfigCustom<AgentMessage>,) => [Agent];
Use preset protocol for request, protocol is not implemented yet.
Property | Description | Type | Default | Version |
---|---|---|---|---|
baseURL | Request for server address | string | - | |
key | Request key | string | - | |
model | Preset protocol model | string | - | |
dangerouslyApiKey | 🔥 dangerouslyApiKey presents security risks. Detailed documentation on this can be found in Explanation | string | - | - |
Custom request protocol.
Property | Description | Type | Default | Version |
---|---|---|---|---|
request | Config custom request, support streaming update | RequestFn |
interface RequestFnInfo<Message> extends Partial<XAgentConfigPreset>, AnyObject {messages?: Message[];message?: Message;}type RequestFn<Message> = (info: RequestFnInfo<Message>,callbacks: {onUpdate: (message: Message) => void;onSuccess: (message: Message) => void;onError: (error: Error) => void;},) => void;
Property | Description | Type | Version |
---|---|---|---|
request | Call the configured request of useXAgent | RequestFn | |
isRequesting | Check if it is requesting | () => boolean |
Status- |
Update Times0 |