actionPath returns URL path for generateContent / streamGenerateContent (Vertex vs AI Studio).
(model, action string)
| 100 | |
| 101 | // actionPath returns URL path for generateContent / streamGenerateContent (Vertex vs AI Studio). |
| 102 | func (a *Adapter) actionPath(model, action string) string { |
| 103 | model = strings.TrimPrefix(model, "models/") |
| 104 | model = strings.TrimSpace(model) |
| 105 | if a.vertex { |
| 106 | proj := strings.TrimSpace(a.cfg.VertexProject) |
| 107 | loc := strings.TrimSpace(a.cfg.VertexLocation) |
| 108 | return fmt.Sprintf("/v1/projects/%s/locations/%s/publishers/google/models/%s:%s", proj, loc, model, action) |
| 109 | } |
| 110 | return fmt.Sprintf("/v1beta/models/%s:%s", model, action) |
| 111 | } |
| 112 | |
| 113 | func (a *Adapter) Invoke(ctx context.Context, req types.BackendRequest) (types.BackendResponse, error) { |
| 114 | text, _ := req.Input["text"].(string) |
no outgoing calls
no test coverage detected