Fetch vendor data with openai

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-05-26 10:45:10 -07:00
parent 8f41461bd1
commit c2f9cb2080
15 changed files with 1044 additions and 25 deletions

View File

@@ -0,0 +1,21 @@
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package probod
type openaiConfig struct {
APIKey string `json:"api-key"`
Temperature float64 `json:"temperature"`
ModelName string `json:"model-name"`
}

View File

@@ -24,6 +24,7 @@ import (
"time"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/getprobo/probo/pkg/agents"
"github.com/getprobo/probo/pkg/awsconfig"
"github.com/getprobo/probo/pkg/connector"
"github.com/getprobo/probo/pkg/coredata"
@@ -59,6 +60,7 @@ type (
AWS awsConfig `json:"aws"`
Mailer mailerConfig `json:"mailer"`
Connectors []connectorConfig `json:"connectors"`
OpenAI openaiConfig `json:"openai"`
}
)
@@ -185,6 +187,14 @@ func (impl *Implm) Run(
}
}
vendorAssessmentConfig := agents.Config{
OpenAIAPIKey: impl.cfg.OpenAI.APIKey,
Temperature: impl.cfg.OpenAI.Temperature,
ModelName: impl.cfg.OpenAI.ModelName,
}
vendorAssessment := agents.NewVendorAssessment(l.Named("vendor-assessment"), vendorAssessmentConfig)
usrmgrService, err := usrmgr.NewService(
ctx,
pgClient,
@@ -205,6 +215,7 @@ func (impl *Implm) Run(
impl.cfg.AWS.Bucket,
impl.cfg.Hostname,
impl.cfg.Auth.Cookie.Secret,
vendorAssessmentConfig,
)
if err != nil {
return fmt.Errorf("cannot create probo service: %w", err)
@@ -216,6 +227,7 @@ func (impl *Implm) Run(
Probo: proboService,
Usrmgr: usrmgrService,
ConnectorRegistry: defaultConnectorRegistry,
VendorAssessment: vendorAssessment,
SafeRedirect: &saferedirect.SafeRedirect{AllowedHost: impl.cfg.Hostname},
Logger: l.Named("http.server"),
Auth: console_v1.AuthConfig{