MCPcopy Create free account
hub / github.com/InferCore/InferCore / New

Function New

internal/adapters/gemini/gemini.go:59–85  ·  view source on GitHub ↗
(cfg config.BackendConfig)

Source from the content-addressed store, hash-verified

57}
58
59func New(cfg config.BackendConfig) *Adapter {
60 timeout := time.Duration(cfg.TimeoutMS) * time.Millisecond
61 if timeout <= 0 {
62 timeout = 60 * time.Second
63 }
64 vertex := cfg.Type == "gemini_vertex"
65 base := strings.TrimSpace(cfg.Endpoint)
66 if base == "" {
67 if vertex {
68 loc := strings.TrimSpace(cfg.VertexLocation)
69 if loc == "" {
70 loc = "us-central1"
71 }
72 base = fmt.Sprintf("https://%s-aiplatform.googleapis.com", loc)
73 } else {
74 base = defaultGeminiEndpoint
75 }
76 }
77 return &Adapter{
78 cfg: cfg,
79 vertex: vertex,
80 baseURL: strings.TrimRight(base, "/"),
81 httpClient: &http.Client{
82 Timeout: timeout,
83 },
84 }
85}
86
87func (a *Adapter) Name() string {
88 return a.cfg.Name

Callers 6

NewBackendFunction · 0.92
TestAdapter_HealthFunction · 0.70

Calls

no outgoing calls