HiveSight / hivesight

GNU Affero General Public License v3.0
2 stars 0 forks source link

Estimate cost of query #36

Closed baogorek closed 2 months ago

baogorek commented 2 months ago

Cost estimation added to both survey and council functions.

Had to bring certain strings out of their functions so that they could be accessed while the user is interacting with the UI.

Using OpenAI's tokenizer for everything, which there is some precedent for on the web.

The on_change callback is used to update the cost when the inputs change. It works pretty well but the cost text is still persists in some cases where I'd rather it not, like when you get the cost in the survey portion and then move to the coucil portion. It will change when you enter some text though.

This exercise was more challenging than I thought and highlights the advantages of doing some design on a piece of paper, where you can sketch out the inputs to the cost function.