Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
📝 docs(README.md): update links to Extending Chloe and User Managemen…
Browse files Browse the repository at this point in the history
…t wiki pages

🚀 feat(logging.go): add function to log cost
🚀 feat(monitors.go): add function to monitor cost
  • Loading branch information
kamushadenes committed Apr 7, 2023
1 parent 3d25cfd commit 86fbbc0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ See [Few-shot prompting](https://github.com/kamushadenes/chloe/wiki/Few-shot_Pro

### Extending capabilities

See [Extending Chloe](https://github.com/kamushadenes/chloe/wiki/Extending_Chloe).
See [Extending Chloe](https://github.com/kamushadenes/chloe/wiki/How_to_add_a_new_Action).

### User management

See [User management](https://github.com/kamushadenes/chloe/wiki/User_Management).
See [User management](https://github.com/kamushadenes/chloe/wiki/Managing_Users).

## Contributing

Expand Down
17 changes: 17 additions & 0 deletions cost/logging.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package cost

import "github.com/kamushadenes/chloe/logging"

func logCost(msg string) {
logger := logging.GetLogger()

l := logger.Info()

for _, k := range GetCategories() {
l = l.Float64(k, GetCategoryCost(k))
}

l = l.Float64("total", GetTotalSessionCost())

l.Msg(msg)
}
15 changes: 0 additions & 15 deletions cost/monitors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,9 @@ package cost
import (
"context"
"github.com/kamushadenes/chloe/config"
"github.com/kamushadenes/chloe/logging"
"time"
)

func logCost(msg string) {
logger := logging.GetLogger()

l := logger.Info()

for _, k := range GetCategories() {
l = l.Float64(k, GetCategoryCost(k))
}

l = l.Float64("total", GetTotalSessionCost())

l.Msg(msg)
}

func MonitorCost(ctx context.Context) {
defer func() {
logCost("total session cost")
Expand Down

0 comments on commit 86fbbc0

Please sign in to comment.