Skip to content

Commit cde1e50

Browse files
committed
fix base_url and streaming in CLI
1 parent 4926e59 commit cde1e50

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

go/autogen/api/agents.go

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ type AssistantAgentConfig struct {
1515
ModelContext *Component `json:"model_context,omitempty"`
1616
SystemMessage *string `json:"system_message,omitempty"`
1717
ReflectOnToolUse bool `json:"reflect_on_tool_use"`
18+
ModelClientStream bool `json:"model_client_stream"`
1819
ToolCallSummaryFormat string `json:"tool_call_summary_format,omitempty"`
1920
Handoffs []Handoff `json:"handoffs,omitempty"`
2021
}

go/autogen/api/models.go

+11-6
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,19 @@ type CreateArgumentsConfig struct {
2222
User *string `json:"user,omitempty"`
2323
}
2424

25+
type StreamOptions struct {
26+
IncludeUsage bool `json:"include_usage,omitempty"`
27+
}
28+
2529
type BaseOpenAIClientConfig struct {
2630
// Base OpenAI fields
27-
Model string `json:"model"`
28-
APIKey *string `json:"api_key,omitempty"`
29-
Timeout *int `json:"timeout,omitempty"`
30-
MaxRetries *int `json:"max_retries,omitempty"`
31-
ModelCapabilities interface{} `json:"model_capabilities,omitempty"`
32-
ModelInfo *ModelInfo `json:"model_info,omitempty"`
31+
Model string `json:"model"`
32+
APIKey *string `json:"api_key,omitempty"`
33+
Timeout *int `json:"timeout,omitempty"`
34+
MaxRetries *int `json:"max_retries,omitempty"`
35+
ModelCapabilities interface{} `json:"model_capabilities,omitempty"`
36+
ModelInfo *ModelInfo `json:"model_info,omitempty"`
37+
StreamOptions *StreamOptions `json:"stream_options,omitempty"`
3338
CreateArgumentsConfig
3439
}
3540

go/controller/cmd/main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ func main() {
101101
flag.BoolVar(&enableHTTP2, "enable-http2", false,
102102
"If set, HTTP/2 will be enabled for the metrics and webhook servers")
103103

104-
flag.StringVar(&autogenStudioBaseURL, "autogen-base-url", "http://127.0.0.1:80/api", "The base url of the Autogen Studio server.")
105-
flag.StringVar(&autogenStudioWsURL, "autogen-ws-url", "ws://127.0.0.1:80/api/ws", "The base url of the Autogen Studio websocket server.")
104+
flag.StringVar(&autogenStudioBaseURL, "autogen-base-url", "http://127.0.0.1:8081/api", "The base url of the Autogen Studio server.")
105+
flag.StringVar(&autogenStudioWsURL, "autogen-ws-url", "ws://127.0.0.1:8081/api/ws", "The base url of the Autogen Studio websocket server.")
106106

107107
flag.StringVar(&defaultModelConfig.Name, "default-model-config-name", "default-model-config", "The name of the default model config.")
108108
flag.StringVar(&defaultModelConfig.Namespace, "default-model-config-namespace", podNamespace, "The namespace of the default model config.")

go/controller/internal/autogen/autogen_api_translator.go

+10-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,12 @@ func (a *apiTranslator) translateGroupChatForTeam(
133133
BaseOpenAIClientConfig: api.BaseOpenAIClientConfig{
134134
Model: modelConfig.Spec.Model,
135135
APIKey: makePtr(string(modelApiKey)),
136+
// By default, we include usage in the stream
137+
// If we aren't streaming this may break, but I think we're good for now
138+
StreamOptions: &api.StreamOptions{
139+
IncludeUsage: true,
140+
},
136141
},
137-
BaseURL: makePtr("http://host.docker.internal:8089/api/account/profile"),
138142
}),
139143
}
140144
modelContext := &api.Component{
@@ -273,6 +277,9 @@ func (a *apiTranslator) translateTaskAgent(
273277
modelContext *api.Component,
274278
) (*api.Component, error) {
275279
// generate an internal round robin "team" for the society of mind agent
280+
meta := agent.ObjectMeta.DeepCopy()
281+
// This is important so we don't output this message in the CLI/UI
282+
meta.Name = "society-of-mind-team"
276283
team := &v1alpha1.Team{
277284
ObjectMeta: agent.ObjectMeta,
278285
TypeMeta: metav1.TypeMeta{
@@ -362,7 +369,8 @@ func translateAssistantAgent(
362369
// TODO(ilackarms): convert to non-ptr with omitempty?
363370
SystemMessage: sysMsgPtr,
364371
ReflectOnToolUse: false,
365-
ToolCallSummaryFormat: "{result}",
372+
ModelClientStream: true,
373+
ToolCallSummaryFormat: "\nTool: \n{tool_name}\n\nArguments:\n\n{arguments}\n\nResult: \n{result}\n",
366374
}),
367375
}, nil
368376
}

0 commit comments

Comments
 (0)