config

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

config

import "github.com/Mgla96/snappr/internal/config"

Package config is the singular place where configuration is loaded and parsed.

Index

Constants

const (
    DefaultConfig = ""
)

ServicePrefix - imagery producer specific env vars have this prefix

const ServicePrefix = "PR"

type Config

Config contains all config parameters for the service

type Config struct {
    Log    Log         `required:"true"`
    Github Github      `required:"true"`
    LLM    LLM         `required:"true"`
    Input  InputConfig `required:"true"`
}

func New
func New() (*Config, error)

New returns the parsed config from the environment.

type Github

type Github struct {
    Token string `required:"true"`
    Owner string `required:"true"`
    Repo  string `required:"true"`
}

type InputConfig

type InputConfig struct {
    KnowledgeSources []KnowledgeSource `mapstructure:"knowledgeSources"`
    PromptWorkflows  []PromptWorkflow  `mapstructure:"promptWorkflows"`
}

type KnowledgeSource

type KnowledgeSource struct {
    Name  string              `mapstructure:"name"`
    Type  KnowledgeSourceType `mapstructure:"type"`
    Value string              `mapstructure:"value"`
}

type KnowledgeSourceType

type KnowledgeSourceType string

const (
    KnowledgeSourceTypeFile KnowledgeSourceType = "file"
    KnowledgeSourceTypeURL  KnowledgeSourceType = "url"
    KnowledgeSourceTypeAPI  KnowledgeSourceType = "api"
    KnowledgeSourceTypeText KnowledgeSourceType = "text"
)

type LLM

type LLM struct {
    Token        string            `required:"true"`
    DefaultModel clients.ModelType `default:"gpt-4-turbo"`
    Endpoint     string
    APIType      clients.APIType `default:"openai"`
    Retries      int             `default:"3"`
}

type Log

Log level config

type Log struct {
    Level zerolog.Level `default:"info"`
}

type PromptWorkflow

type PromptWorkflow struct {
    Name  string               `mapstructure:"name"`
    Steps []PromptWorkflowStep `mapstructure:"steps"`
}

type PromptWorkflowStep

type PromptWorkflowStep struct {
    Prompt      string `mapstructure:"prompt"`
    InputSource string `mapstructure:"inputSource"`
}

Generated by gomarkdoc

Documentation

Overview

Package config is the singular place where configuration is loaded and parsed.

Index

Constants

View Source
const (
	DefaultConfig = ""
)
View Source
const ServicePrefix = "PR"

ServicePrefix - imagery producer specific env vars have this prefix

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Log    Log         `required:"true"`
	Github Github      `required:"true"`
	LLM    LLM         `required:"true"`
	Input  InputConfig `required:"true"`
}

Config contains all config parameters for the service

func New

func New() (*Config, error)

New returns the parsed config from the environment.

type Github

type Github struct {
	Token string `required:"true"`
	Owner string `required:"true"`
	Repo  string `required:"true"`
}

type InputConfig

type InputConfig struct {
	KnowledgeSources []KnowledgeSource `mapstructure:"knowledgeSources"`
	PromptWorkflows  []PromptWorkflow  `mapstructure:"promptWorkflows"`
}

type KnowledgeSource

type KnowledgeSource struct {
	Name  string              `mapstructure:"name"`
	Type  KnowledgeSourceType `mapstructure:"type"`
	Value string              `mapstructure:"value"`
}

type KnowledgeSourceType

type KnowledgeSourceType string
const (
	KnowledgeSourceTypeFile KnowledgeSourceType = "file"
	KnowledgeSourceTypeURL  KnowledgeSourceType = "url"
	KnowledgeSourceTypeAPI  KnowledgeSourceType = "api"
	KnowledgeSourceTypeText KnowledgeSourceType = "text"
)

type LLM

type LLM struct {
	Token        string            `required:"true"`
	DefaultModel clients.ModelType `default:"gpt-4-turbo"`
	Endpoint     string
	APIType      clients.APIType `default:"openai"`
	Retries      int             `default:"3"`
}

type Log

type Log struct {
	Level zerolog.Level `default:"info"`
}

Log level config

type PromptWorkflow

type PromptWorkflow struct {
	Name  string               `mapstructure:"name"`
	Steps []PromptWorkflowStep `mapstructure:"steps"`
}

type PromptWorkflowStep

type PromptWorkflowStep struct {
	Prompt      string `mapstructure:"prompt"`
	InputSource string `mapstructure:"inputSource"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳