Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generalize overriding default values via CLI #108

Open
github-actions bot opened this issue Sep 28, 2022 · 0 comments
Open

generalize overriding default values via CLI #108

github-actions bot opened this issue Sep 28, 2022 · 0 comments
Labels

Comments

@github-actions
Copy link

FIXME: create default config methods for these

// TODO: generalize overriding default values via CLI

	if err := conf.Load(); err != nil {
		return nil, err
	}
	// TODO: generalize overriding default values via CLI
	conf.SetDefaults()
	// override OpenAI URL
	if openAIURL != "" {
		conf.OpenAI.BaseURL = openAIURL
	}

	// load files
	fm := filemap.NewFilemap()
	if err := fm.LoadFiles(files); err != nil {
		log.Fatalf("error loading files: %s\n", err.Error())
	}
	if len(filesets) > 0 {
		log.Printf("loading filesets: %v\n", filesets)
	}
	if err := fm.LoadFilesets(filesets, conf, config.ConfigFile); err != nil {
		log.Fatalf("error loading filesets: %s\n", err.Error())
	}
	filemapText := fm.EncodeToInputText()

	// select backend type
	selectedBackend := ai.Backend(aiBackend)
	if selectedBackend == "" {
		selectedBackend = conf.Backend
	}

	// configure backends
	// FIXME: create default config methods for these
	r := Request{
		Config:       conf,
		Filemap:      fm,
		FilemapText:  filemapText,
		UserRequest:  request,
		IsWrite:      write,
		OutputType:   outputType,
		NTokens:      nTokens,
		NCompletions: nCompletions,
		Backend:      selectedBackend,
	}

	return &r, nil
@github-actions github-actions bot added the todo label Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants