MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / CreateLLMClient

Function CreateLLMClient

api/client.go:869–892  ·  view source on GitHub ↗
(
	apiKey string,
	baseURL string,
	model string,
	maxTokens int,
	thinkingBudgetTokens *int,
	retryConfig *RetryConfig,
	apiType ...string,
)

Source from the content-addressed store, hash-verified

867 }
868
869 if finishReason == "tool_calls" {
870 indexes := make([]int, 0, len(toolCallBuffers))
871 for idx := range toolCallBuffers {
872 indexes = append(indexes, idx)
873 }
874 sort.Ints(indexes)
875
876 for _, idx := range indexes {
877 buf := toolCallBuffers[idx]
878 if buf.Name != "" {
879 parsed := map[string]any{}
880 if strings.TrimSpace(buf.Arguments) != "" {
881 if err := json.Unmarshal([]byte(buf.Arguments), &parsed); err != nil {
882 parsed = map[string]any{}
883 }
884 }
885
886 out <- EventResult{Event: map[string]any{
887 "type": "tool_use",
888 "id": buf.ID,
889 "name": buf.Name,
890 "input": parsed,
891 }}
892 } else if buf.Arguments != "" {
893 out <- EventResult{Event: map[string]any{
894 "type": "error",
895 "message": fmt.Sprintf("Tool call at index %d is missing a function name; arguments were: %s", idx, truncateString(buf.Arguments, 200)),

Callers 8

autoCompactMethod · 0.92
AutoCompactFunction · 0.92
summarizeMethod · 0.92
BuildClientMethod · 0.92
ExecuteOneRequestMethod · 0.92
finalizeTimedOutRunMethod · 0.92
recallClientFactoryMethod · 0.92
NewAPIClientFunction · 0.85

Calls 2

NewLLMClientBaseFunction · 0.85
useOpenAICompatibleFunction · 0.85

Tested by

no test coverage detected