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

Method Invoke

internal/adapters/gemini/gemini.go:113–130  ·  view source on GitHub ↗
(ctx context.Context, req types.BackendRequest)

Source from the content-addressed store, hash-verified

111}
112
113func (a *Adapter) Invoke(ctx context.Context, req types.BackendRequest) (types.BackendResponse, error) {
114 text, _ := req.Input["text"].(string)
115 if text == "" {
116 text = "No text provided."
117 }
118 model := a.modelID()
119 if model == "" {
120 return types.BackendResponse{}, upstream.New(upstream.KindBackendError, "gemini backend requires default_model")
121 }
122 if a.apiKey() == "" {
123 return types.BackendResponse{}, upstream.New(upstream.KindBackendError, "gemini backend requires api_key")
124 }
125
126 if req.Options.Stream {
127 return a.invokeStream(ctx, text, model)
128 }
129 return a.invokeNonStream(ctx, text, model)
130}
131
132func (a *Adapter) invokeNonStream(ctx context.Context, text, model string) (types.BackendResponse, error) {
133 t0 := time.Now()

Callers

nothing calls this directly

Calls 5

modelIDMethod · 0.95
apiKeyMethod · 0.95
invokeStreamMethod · 0.95
invokeNonStreamMethod · 0.95
NewFunction · 0.92

Tested by

no test coverage detected