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

Add output token control to CLI interface #2225

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

compilebunny
Copy link

Describe your changes

Updated the text interface (CLI) to let the user set the number of output tokens via the command "/token". If this is accepted, I will probably add LocalDocs/Langchain support next time,

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.
  • I have added thorough documentation for my code.
  • I have tagged PR with relevant project labels. I acknowledge that a PR without labels may be dismissed.
  • If this PR addresses a bug, I have provided both a screenshot/video of the original bug and the working solution.

Demo

Steps to Reproduce

Notes

This is a simple update.

Comment on lines 17 to 30
# Set default values
n_predict_default = 200
n_predict = n_predict_default

def getUserTokens(n_tokens_start):
print(f"Tokens = {n_tokens_start}; ")
t_input = input("New max tokens? ")
if t_input.isdigit():
t_input=int(t_input)
if t_input > 0:
print(f"New tokens {t_input}")
global n_predict
n_predict=t_input
else: print("Invalid entry")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • n_predict_default is only used once, remove it
  • use four spaces for indentation, not tabs
  • else: should be on its own line
  • use spaces around =
  • the ; at the end of the first line doesn't make sense, did you want end="" as well?
  • check for ValueError from int(), do not use isdigit
  • you need to sign off on your commit to accept the DCO

Signed-off-by: Jonathan <compilebunny@qgenuity.com>
Signed-off-by: Jonathan <compilebunny@qgenuity.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants