Skip to content

Commit

Permalink
Merge pull request #57 from BishoyHanyRaafat/main
Browse files Browse the repository at this point in the history
Update poetry.lock and fix the issue if the model id is invalid in the pickle file
  • Loading branch information
mark-at-pieces authored Mar 19, 2024
2 parents bd8089e + dfa918a commit cd41c9e
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 82 deletions.
122 changes: 47 additions & 75 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 14 additions & 7 deletions src/pieces/commands/commands_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,27 @@ def startup(): # startup function to run before the cli begin
# Call the connect api
application = connect_api()


# MODELS
models = get_models_ids()
create_file = True
# Check if the models file exists
if not models_file.is_file():
default_model_name = "GPT-3.5-turbo Chat Model"
model_id = models[default_model_name]["uuid"] # default model id
word_limit = models[default_model_name]["word_limit"] # The word limit of the default model
dump_pickle(file = models_file, model_id=model_id, word_limit=word_limit)
else:
if models_file.is_file():
with open(models_file, 'rb') as f:
model_data = pickle.load(f)
model_id = model_data["model_id"]
word_limit = model_data["word_limit"]
try: # Checks if the current model is valid
get_current_model_name()
create_file = False
except:
pass

if create_file:
default_model_name = "GPT-3.5-turbo Chat Model"
model_id = models[default_model_name]["uuid"] # default model id
word_limit = models[default_model_name]["word_limit"] # The word limit of the default model
dump_pickle(file = models_file, model_id=model_id, word_limit=word_limit)

else:
server_startup_failed()

Expand Down

0 comments on commit cd41c9e

Please sign in to comment.