resume_chatter

package module
v0.0.0-...-54c2d45 Latest Latest
Warning

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

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

README

resume-chatter

a chat bot for resumes

Development

Based on docs from goship.it.

Install dependencies:

> go install github.com/a-h/templ/cmd/templ@latest
...
> go install github.com/air-verse/air@latest
...
> sudo dnf install nodejs-npm just
...

Then install TailwindCSS and DaisyUI:

> npm i -D tailwindcss @tailwindcss/typography daisyui

Ensure templ and air are on your PATH:

> which templ
~/go/bin/templ
> which air
~/go/bin/air

Invoke air to run the local dev server and automatically rebuild and reload when source files change.

> air

  __    _   ___
 / /\  | | | |_)
/_/--\ |_| |_| \_ v1.52.3, built with Go go1.23.0

watching .
watching cmd
watching node_modules
...
watching static
watching static/css
!exclude tmp
watching views
watching views/components
building...

Rebuilding...

🌼   daisyUI 4.12.10
├─ ✔︎ 1 theme added		https://daisyui.com/docs/themes
╰─ ❤︎ Support daisyUI project:	https://opencollective.com/daisyui


Done in 487ms.
templ generate
(✓) Complete [ updates=1 duration=7.789752ms ]
go build -o tmp/main .
running...

OpenAI API Notes

langchain expects an OPENAI_API_KEY env variable. The justfile expects this to live in a .env at the root of the repo.

go-plugin notes

Install buf, as recommended in the go-plugin example:

> github.com/bufbuild/buf/cmd/buf@v1.40.0

The proto files lives in protoc/ subdirectory. buf configuration lives in buf.yml and buf.gen.yml.

Basic hello world testing:

> go run cmd/bufserver/main.go &
...
listening on localhost:8081
> buf curl --schema . --data '{"question": "what is happening?"}' http://localhost:8081/chat.v1.ChatService/Ask
2024/09/06 11:55:30 Got a request to answer what is happening?
{}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type History

type History struct {
	// contains filtered or unexported fields
}

func (*History) Append

func (h *History) Append(cs ...model.ChatMessage)

func (*History) GetChat

func (h *History) GetChat() []model.ChatMessage

func (*History) UpdateWaiting

func (h *History) UpdateWaiting(newBubble string)

type LLM

type LLM struct {
	LLM  *openai.LLM
	Docs []schema.Document
}

func NewLLM

func NewLLM(ctx context.Context) (*LLM, error)

func (*LLM) Call

func (l *LLM) Call(ctx context.Context, question string) (map[string]any, error)

type LLMAlert

type LLMAlert struct {
	// contains filtered or unexported fields
}

func (*LLMAlert) GetErr

func (a *LLMAlert) GetErr() error

func (*LLMAlert) Model

func (a *LLMAlert) Model() model.Alert

func (*LLMAlert) SetErr

func (a *LLMAlert) SetErr(err error)

type Server

type Server struct {
	Start       time.Time
	LLM         *LLM
	Docs        []schema.Document
	ChatHistory History
	Alert       LLMAlert
}

func NewServer

func NewServer(ctx context.Context) (*Server, error)

func (*Server) AskHandler

func (s *Server) AskHandler(w http.ResponseWriter, r *http.Request)

func (*Server) DismissHandler

func (s *Server) DismissHandler(w http.ResponseWriter, r *http.Request)

func (*Server) MessageHandler

func (s *Server) MessageHandler(w http.ResponseWriter, r *http.Request)

func (*Server) RootHandler

func (s *Server) RootHandler(w http.ResponseWriter, r *http.Request)

func (*Server) Serve

func (s *Server) Serve(address string) error

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL