Process call analysis jobs in AI worker
This commit is contained in:
@@ -24,8 +24,8 @@ service.
|
|||||||
|
|
||||||
## Built-in workers
|
## Built-in workers
|
||||||
|
|
||||||
The first built-in worker processes `llm_chat` and `chat_completion` jobs whose
|
The first built-in worker processes `llm_chat`, `chat_completion` and
|
||||||
`model_profile` equals `LLM_MODEL`.
|
`call_analysis` jobs whose `model_profile` equals `LLM_MODEL`.
|
||||||
|
|
||||||
Input can be either explicit messages:
|
Input can be either explicit messages:
|
||||||
|
|
||||||
@@ -42,6 +42,10 @@ Input can be either explicit messages:
|
|||||||
or compact `system` / `user` fields. The completed job result contains
|
or compact `system` / `user` fields. The completed job result contains
|
||||||
`content`, `model`, `usage` and `duration_ms`.
|
`content`, `model`, `usage` and `duration_ms`.
|
||||||
|
|
||||||
|
`call_analysis` uses the same input contract as `llm_chat`; callers may include
|
||||||
|
domain metadata fields in `input`, but the worker only reads chat fields such as
|
||||||
|
`system`, `user`, `messages`, `max_tokens` and `response_format`.
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
- `POST /api/v1/jobs` creates one job.
|
- `POST /api/v1/jobs` creates one job.
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
TaskLLMChat = "llm_chat"
|
TaskLLMChat = "llm_chat"
|
||||||
TaskChatCompletion = "chat_completion"
|
TaskChatCompletion = "chat_completion"
|
||||||
|
TaskCallAnalysis = "call_analysis"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Worker struct {
|
type Worker struct {
|
||||||
@@ -72,7 +73,7 @@ func (w *Worker) tick(ctx context.Context) {
|
|||||||
}
|
}
|
||||||
jobs, err := w.store.ClaimJobs(ctx, model.ClaimJobs{
|
jobs, err := w.store.ClaimJobs(ctx, model.ClaimJobs{
|
||||||
WorkerID: w.workerID,
|
WorkerID: w.workerID,
|
||||||
TaskTypes: []string{TaskLLMChat, TaskChatCompletion},
|
TaskTypes: []string{TaskLLMChat, TaskChatCompletion, TaskCallAnalysis},
|
||||||
ModelProfiles: []string{w.modelProfile},
|
ModelProfiles: []string{w.modelProfile},
|
||||||
Limit: w.claimLimit,
|
Limit: w.claimLimit,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user