Deployment Plan AI Model Configuration¶
This topic describes the model configuration for Security AI Detection and AI Semantic Monitor in the Deployment Plan.
Choose an access method based on your deployment environment:
- Connect to AI Hub through Studio: Create and manage rules in the Guance console. The Management Center Func on the underlying platform calls models through AI Hub.
- Connect to your own model through Func: In the private DataFlux Func deployed independently by the customer, administrators maintain scheduled jobs that directly call an OpenAI-compatible model service, without connecting to AI Hub.
When using both methods, configure the model service separately in the corresponding Func instance.
Connect to AI Hub Through Studio¶
Prerequisites¶
- The Guance Deployment Plan and Management Center DataFlux Func are deployed;
- Administrators can create and manage Security AI Detection rules and AI Semantic Monitors;
- The Management Center Func can access AI Hub at
https://agent-ai-hub.guance.com.
Configure Model Service¶
- Log in to the Management Center DataFlux Func on the underlying platform, and go to Development > Environment Variables;
- Set
CUSTOM_AI_API_TYPEtoaiHub; - Set
CUSTOM_AI_API_BASE_URLtohttps://agent-ai-hub.guance.com.
Security AI Detection and AI Semantic Monitor share the Workspace built-in AI system key, which Studio automatically passes with the job.
Job Sync and System Key
When Studio saves a rule, it syncs the job, which may overwrite parameters manually modified in Func. If you change CUSTOM_AI_API_TYPE of the Management Center Func to custom, the Workspace system key may be sent to the model service. When connecting to your own model, use a separate private Func and scheduled jobs maintained directly by administrators.
Verify Configuration¶
- In Studio, create or select a Security AI Detection rule and an AI Semantic Monitor, and complete their configuration separately;
- Run the two jobs separately, using the manual execution entry point provided in the current version or waiting for scheduled execution;
- Check the execution records separately to confirm that detection is complete.
Connect to Your Own Model Through Func¶
Prerequisites¶
- A private DataFlux Func has been independently deployed by the customer, and you have confirmed that the instance can access your own model service. For deployment instructions, see DataFlux Func Deployment Guide;
- Func scheduled jobs maintained directly by administrators are ready, and other parameters required by the jobs have been configured;
- The model service address, provider API key, and model names actually supported by the provider are ready;
- The model API supports non-streaming Chat Completions, tool calls, and the
max_completion_tokensparameter. For details, see API Compatibility Requirements.
Configure Model Service¶
In Development > Environment Variables of the private Func, add the following configurations one by one, or write the same configuration items to /data/user-config.yaml in the container. If the same item is configured in both places, the environment variable in Func takes precedence. For configuration instructions, see Func Configuration Items.
CUSTOM_AI_API_TYPE: Set tocustomto use an OpenAI-compatible API. The default value of this configuration item isaiHub.CUSTOM_AI_API_BASE_URL: Enter the root address of the model service, a base URL ending in/v1, or the full Chat Completions address.CUSTOM_AI_DEFAULT_MODEL: Enter a model name supported by the provider. Incustommode, AI Hub model aliases such asauto:fastare not automatically converted.
Jobs on the same Func instance share the API type, service address, and default model.
Address Completion and Model Selection¶
The following three address formats all request https://ai.example.com/v1/chat/completions:
If a detection job specifies a model separately, Func uses the model specified by the job first. When switching model services, also check the model names specified by each job and confirm that the provider supports the model. For detailed rules, see Default Model and Address Rules.
Configure and Rotate Provider API Keys¶
- In the private Func instance used for your own model, go to Management > Scheduled Jobs and find the job to configure;
- Open Configuration, and under Specified Parameters, set
workspace_agent_api_keyto the provider API key; - Keep the other parameters and save, then repeat the configuration for other jobs that need to use your own model.
When changing the provider key, update all jobs that use the key. For job configuration instructions, see Func Scheduled Jobs.
Billing¶
Your own model is billed according to provider rules. In custom mode, Guance does not count AI Hub credits, and the per-detection credit budget does not take effect.
For more information, see AI API Mode.
Verify Configuration¶
- Run the configured Func job, check the job record, and confirm that execution succeeds;
- Check the request and the model actually used on the model service side;
- After changing the provider key, re-verify all affected jobs.
FAQ¶
When using test data known to match rules, you can check in Guance whether the expected events are generated. Manual execution may also trigger alerts according to the rule configuration.
Request Timeout or Unable to Connect¶
From the Func environment that executes the job, check the service address, DNS, network connectivity, and TLS certificate.
401 or 403 Returned¶
- When using AI Hub, check whether authentication for the Workspace AI system key is working properly;
- When using your own model, check whether the provider key is valid and whether it has permission to call the target model.
API or Model Not Found¶
Check the completed request address, the provider model name, and whether the job specifies another model separately.
Request Parameter or Tool Call Error¶
Check whether the service and model support non-streaming Chat Completions, tool calls, and the max_completion_tokens parameter.