2
Makefile
2
Makefile
@@ -9,7 +9,7 @@ cleanup-tests:
|
|||||||
docker compose down
|
docker compose down
|
||||||
|
|
||||||
tests: prepare-tests
|
tests: prepare-tests
|
||||||
LOCALAGI_MODEL="openthinker-7b" LOCALAI_API_URL="http://localhost:8081" LOCALAGI_API_URL="http://localhost:8080" $(GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --fail-fast -v -r ./...
|
LOCALAGI_MODEL="gemma-3-4b-it" LOCALAI_API_URL="http://localhost:8081" LOCALAGI_API_URL="http://localhost:8080" $(GOCMD) run github.com/onsi/ginkgo/v2/ginkgo --fail-fast -v -r ./...
|
||||||
|
|
||||||
run-nokb:
|
run-nokb:
|
||||||
$(MAKE) run KBDISABLEINDEX=true
|
$(MAKE) run KBDISABLEINDEX=true
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ LocalAGI supports multiple hardware configurations through Docker Compose profil
|
|||||||
- Supports text, multimodal, and image generation models
|
- Supports text, multimodal, and image generation models
|
||||||
- Run with: `docker compose --profile nvidia up`
|
- Run with: `docker compose --profile nvidia up`
|
||||||
- Default models:
|
- Default models:
|
||||||
- Text: `openthinker-7b`
|
- Text: `gemma-3-4b-it`
|
||||||
- Multimodal: `minicpm-v-2_6`
|
- Multimodal: `minicpm-v-2_6`
|
||||||
- Image: `flux.1-dev`
|
- Image: `flux.1-dev`
|
||||||
- Environment variables:
|
- Environment variables:
|
||||||
@@ -99,7 +99,7 @@ LocalAGI supports multiple hardware configurations through Docker Compose profil
|
|||||||
- Supports text, multimodal, and image generation models
|
- Supports text, multimodal, and image generation models
|
||||||
- Run with: `docker compose --profile intel up`
|
- Run with: `docker compose --profile intel up`
|
||||||
- Default models:
|
- Default models:
|
||||||
- Text: `openthinker-7b`
|
- Text: `gemma-3-4b-it`
|
||||||
- Multimodal: `minicpm-v-2_6`
|
- Multimodal: `minicpm-v-2_6`
|
||||||
- Image: `sd-1.5-ggml`
|
- Image: `sd-1.5-ggml`
|
||||||
- Environment variables:
|
- Environment variables:
|
||||||
@@ -130,7 +130,7 @@ docker compose --profile intel up
|
|||||||
```
|
```
|
||||||
|
|
||||||
If no models are specified, it will use the defaults:
|
If no models are specified, it will use the defaults:
|
||||||
- Text model: `openthinker-7b`
|
- Text model: `gemma-3-4b-it`
|
||||||
- Multimodal model: `minicpm-v-2_6`
|
- Multimodal model: `minicpm-v-2_6`
|
||||||
- Image model: `flux.1-dev` (NVIDIA) or `sd-1.5-ggml` (Intel)
|
- Image model: `flux.1-dev` (NVIDIA) or `sd-1.5-ggml` (Intel)
|
||||||
|
|
||||||
|
|||||||
@@ -429,96 +429,28 @@ func (a *Agent) pickAction(ctx context.Context, templ string, messages []openai.
|
|||||||
}, c...)
|
}, c...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// thoughtPromptStringBuilder := strings.Builder{}
|
thought, err := a.decision(ctx,
|
||||||
// thoughtPromptStringBuilder.WriteString("You have to pick an action based on the conversation and the prompt. Describe the full reasoning process for your choice. Here is a list of actions: ")
|
c,
|
||||||
// for _, m := range a.availableActions() {
|
types.Actions{action.NewReasoning()}.ToTools(),
|
||||||
// thoughtPromptStringBuilder.WriteString(
|
action.NewReasoning().Definition().Name.String(), maxRetries)
|
||||||
// m.Definition().Name.String() + ": " + m.Definition().Description + "\n",
|
if err != nil {
|
||||||
// )
|
return nil, nil, "", err
|
||||||
// }
|
}
|
||||||
|
originalReasoning := ""
|
||||||
// thoughtPromptStringBuilder.WriteString("To not use any action, respond with 'none'")
|
response := &action.ReasoningResponse{}
|
||||||
|
if thought.actionParams != nil {
|
||||||
//thoughtPromptStringBuilder.WriteString("\n\nConversation: " + Messages(c).RemoveIf(func(msg openai.ChatCompletionMessage) bool {
|
if err := thought.actionParams.Unmarshal(response); err != nil {
|
||||||
// return msg.Role == "system"
|
return nil, nil, "", err
|
||||||
//}).String())
|
}
|
||||||
|
originalReasoning = response.Reasoning
|
||||||
//thoughtPrompt := thoughtPromptStringBuilder.String()
|
}
|
||||||
|
if thought.message != "" {
|
||||||
//thoughtConv := []openai.ChatCompletionMessage{}
|
originalReasoning = thought.message
|
||||||
|
}
|
||||||
|
|
||||||
xlog.Debug("[pickAction] picking action", "messages", c)
|
xlog.Debug("[pickAction] picking action", "messages", c)
|
||||||
thought, err := a.askLLM(ctx,
|
// thought, err := a.askLLM(ctx,
|
||||||
c,
|
// c,
|
||||||
maxRetries,
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, "", err
|
|
||||||
}
|
|
||||||
originalReasoning := thought.Content
|
|
||||||
xlog.Debug("[pickAction] original reasoning", "originalReasoning", originalReasoning)
|
|
||||||
// From the thought, get the action call
|
|
||||||
// Get all the available actions IDs
|
|
||||||
|
|
||||||
// by grammar, let's decide if we have achieved the goal
|
|
||||||
// 1. analyze response and check if goal is achieved
|
|
||||||
|
|
||||||
// Extract the goal first
|
|
||||||
params, err := a.decision(ctx,
|
|
||||||
append(
|
|
||||||
[]openai.ChatCompletionMessage{
|
|
||||||
{
|
|
||||||
Role: "system",
|
|
||||||
Content: "Your only task is to extract the goal from the following conversation",
|
|
||||||
}}, messages...),
|
|
||||||
types.Actions{action.NewGoal()}.ToTools(),
|
|
||||||
action.NewGoal().Definition().Name.String(), maxRetries)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, "", fmt.Errorf("failed to get the action tool parameters: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
goalResponse := action.GoalResponse{}
|
|
||||||
err = params.actionParams.Unmarshal(&goalResponse)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
if goalResponse.Goal == "" {
|
|
||||||
xlog.Debug("[pickAction] no goal found")
|
|
||||||
return nil, nil, "", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the goal was achieved
|
|
||||||
params, err = a.decision(ctx,
|
|
||||||
[]openai.ChatCompletionMessage{
|
|
||||||
{
|
|
||||||
Role: "system",
|
|
||||||
Content: "You have to understand if the goal is achieved or not from the following reasoning. The goal: " + goalResponse.Goal,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Role: "user",
|
|
||||||
Content: originalReasoning,
|
|
||||||
}},
|
|
||||||
types.Actions{action.NewGoal()}.ToTools(),
|
|
||||||
action.NewGoal().Definition().Name.String(), maxRetries)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, "", fmt.Errorf("failed to get the action tool parameters: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
err = params.actionParams.Unmarshal(&goalResponse)
|
|
||||||
if err != nil {
|
|
||||||
return nil, nil, "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
if goalResponse.Achieved {
|
|
||||||
xlog.Debug("[pickAction] goal achieved", "goal", goalResponse.Goal)
|
|
||||||
return nil, nil, "", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// if the goal is not achieved, pick an action
|
|
||||||
xlog.Debug("[pickAction] goal not achieved", "goal", goalResponse.Goal)
|
|
||||||
|
|
||||||
xlog.Debug("[pickAction] thought", "conv", c, "originalReasoning", originalReasoning)
|
|
||||||
|
|
||||||
actionsID := []string{"reply"}
|
actionsID := []string{"reply"}
|
||||||
for _, m := range a.availableActions() {
|
for _, m := range a.availableActions() {
|
||||||
@@ -533,20 +465,11 @@ func (a *Agent) pickAction(ctx context.Context, templ string, messages []openai.
|
|||||||
// to avoid hallucinations
|
// to avoid hallucinations
|
||||||
|
|
||||||
// Extract an action
|
// Extract an action
|
||||||
params, err = a.decision(ctx,
|
params, err := a.decision(ctx,
|
||||||
[]openai.ChatCompletionMessage{
|
append(c, openai.ChatCompletionMessage{
|
||||||
{
|
Role: "system",
|
||||||
Role: "system",
|
Content: "Pick the relevant action given the following reasoning: " + originalReasoning,
|
||||||
Content: prompt,
|
}),
|
||||||
},
|
|
||||||
{
|
|
||||||
Role: "system",
|
|
||||||
Content: "Extract an action to perform from the following reasoning: ",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
Role: "user",
|
|
||||||
Content: originalReasoning,
|
|
||||||
}},
|
|
||||||
types.Actions{intentionsTools}.ToTools(),
|
types.Actions{intentionsTools}.ToTools(),
|
||||||
intentionsTools.Definition().Name.String(), maxRetries)
|
intentionsTools.Definition().Name.String(), maxRetries)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ services:
|
|||||||
image: localai/localai:master-ffmpeg-core
|
image: localai/localai:master-ffmpeg-core
|
||||||
command:
|
command:
|
||||||
# - gemma-3-12b-it
|
# - gemma-3-12b-it
|
||||||
- ${MODEL_NAME:-openthinker-7b}
|
- ${MODEL_NAME:-gemma-3-4b-it}
|
||||||
- granite-embedding-107m-multilingual
|
- granite-embedding-107m-multilingual
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8080/readyz"]
|
test: ["CMD", "curl", "-f", "http://localhost:8080/readyz"]
|
||||||
@@ -39,7 +39,7 @@ services:
|
|||||||
count: 1
|
count: 1
|
||||||
capabilities: [gpu]
|
capabilities: [gpu]
|
||||||
command:
|
command:
|
||||||
- ${MODEL_NAME:-openthinker-7b}
|
- ${MODEL_NAME:-gemma-3-4b-it}
|
||||||
- ${MULTIMODAL_MODEL:-minicpm-v-2_6}
|
- ${MULTIMODAL_MODEL:-minicpm-v-2_6}
|
||||||
- ${IMAGE_MODEL:-flux.1-dev}
|
- ${IMAGE_MODEL:-flux.1-dev}
|
||||||
- granite-embedding-107m-multilingual
|
- granite-embedding-107m-multilingual
|
||||||
@@ -57,7 +57,7 @@ services:
|
|||||||
- /dev/dri/card1
|
- /dev/dri/card1
|
||||||
- /dev/dri/renderD129
|
- /dev/dri/renderD129
|
||||||
command:
|
command:
|
||||||
- ${MODEL_NAME:-openthinker-7b}
|
- ${MODEL_NAME:-gemma-3-4b-it}
|
||||||
- ${MULTIMODAL_MODEL:-minicpm-v-2_6}
|
- ${MULTIMODAL_MODEL:-minicpm-v-2_6}
|
||||||
- ${IMAGE_MODEL:-sd-1.5-ggml}
|
- ${IMAGE_MODEL:-sd-1.5-ggml}
|
||||||
- granite-embedding-107m-multilingual
|
- granite-embedding-107m-multilingual
|
||||||
@@ -96,7 +96,7 @@ services:
|
|||||||
- 8080:3000
|
- 8080:3000
|
||||||
#image: quay.io/mudler/localagi:master
|
#image: quay.io/mudler/localagi:master
|
||||||
environment:
|
environment:
|
||||||
- LOCALAGI_MODEL=${MODEL_NAME:-openthinker-7b}
|
- LOCALAGI_MODEL=${MODEL_NAME:-gemma-3-4b-it}
|
||||||
- LOCALAGI_LLM_API_URL=http://localai:8080
|
- LOCALAGI_LLM_API_URL=http://localai:8080
|
||||||
#- LOCALAGI_LLM_API_KEY=sk-1234567890
|
#- LOCALAGI_LLM_API_KEY=sk-1234567890
|
||||||
- LOCALAGI_LOCALRAG_URL=http://localrecall:8080
|
- LOCALAGI_LOCALRAG_URL=http://localrecall:8080
|
||||||
@@ -113,7 +113,7 @@ services:
|
|||||||
extends:
|
extends:
|
||||||
service: localagi
|
service: localagi
|
||||||
environment:
|
environment:
|
||||||
- LOCALAGI_MODEL=${MODEL_NAME:-openthinker-7b}
|
- LOCALAGI_MODEL=${MODEL_NAME:-gemma-3-4b-it}
|
||||||
- LOCALAGI_MULTIMODAL_MODEL=${MULTIMODAL_MODEL:-minicpm-v-2_6}
|
- LOCALAGI_MULTIMODAL_MODEL=${MULTIMODAL_MODEL:-minicpm-v-2_6}
|
||||||
- LOCALAGI_IMAGE_MODEL=${IMAGE_MODEL:-flux.1-dev}
|
- LOCALAGI_IMAGE_MODEL=${IMAGE_MODEL:-flux.1-dev}
|
||||||
- LOCALAGI_LLM_API_URL=http://localai:8080
|
- LOCALAGI_LLM_API_URL=http://localai:8080
|
||||||
@@ -127,7 +127,7 @@ services:
|
|||||||
extends:
|
extends:
|
||||||
service: localagi
|
service: localagi
|
||||||
environment:
|
environment:
|
||||||
- LOCALAGI_MODEL=${MODEL_NAME:-openthinker-7b}
|
- LOCALAGI_MODEL=${MODEL_NAME:-gemma-3-4b-it}
|
||||||
- LOCALAGI_MULTIMODAL_MODEL=${MULTIMODAL_MODEL:-minicpm-v-2_6}
|
- LOCALAGI_MULTIMODAL_MODEL=${MULTIMODAL_MODEL:-minicpm-v-2_6}
|
||||||
- LOCALAGI_IMAGE_MODEL=${IMAGE_MODEL:-sd-1.5-ggml}
|
- LOCALAGI_IMAGE_MODEL=${IMAGE_MODEL:-sd-1.5-ggml}
|
||||||
- LOCALAGI_LLM_API_URL=http://localai:8080
|
- LOCALAGI_LLM_API_URL=http://localai:8080
|
||||||
|
|||||||
Reference in New Issue
Block a user