xonecas.io
6119
My

mysis / files

mysis / internal / provider / factory.go

900 bytes
1package provider
2
3type OllamaFactory struct {
4	name     string
5	endpoint string
6}
7
8func NewOllamaFactory(name string, endpoint string) *OllamaFactory {
9	return &OllamaFactory{
10		name:     name,
11		endpoint: endpoint,
12	}
13}
14
15func (f *OllamaFactory) Name() string { return f.name }
16
17func (f *OllamaFactory) Create(model string, temperature float64) Provider {
18	return NewOllamaWithTemp(f.name, f.endpoint, model, temperature)
19}
20
21type OpenCodeFactory struct {
22	name     string
23	endpoint string
24	apiKey   string
25}
26
27func NewOpenCodeFactory(name string, endpoint, apiKey string) *OpenCodeFactory {
28	return &OpenCodeFactory{
29		name:     name,
30		endpoint: endpoint,
31		apiKey:   apiKey,
32	}
33}
34
35func (f *OpenCodeFactory) Name() string { return f.name }
36
37func (f *OpenCodeFactory) Create(model string, temperature float64) Provider {
38	return NewOpenCodeWithTemp(f.name, f.endpoint, model, f.apiKey, temperature)
39}