Skip to content

Commit

Permalink
Merge branch 'master' into config-tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiannis128 committed Feb 15, 2024
2 parents 35ab87f + 5e37044 commit 8778df9
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 21 deletions.
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ py = "*" # Dependency of pytest-regtest
build = "*"
twine = "*"
hatch = "*"
transformers = "*"
torch = "*"

[requires]
python_version = "3.11"
2 changes: 1 addition & 1 deletion esbmc_ai/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Author: Yiannis Charalambous

__version__ = "v0.4.0.dev6"
__version__ = "v0.4.0"
__author__: str = "Yiannis Charalambous"
20 changes: 1 addition & 19 deletions esbmc_ai/base_chat_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,8 @@ def send_message(self, message: str) -> ChatResponse:
response = ChatResponse(
finish_reason=FinishReason.stop,
message=response_message,
total_tokens=self.ai_model.tokens,
)
# FIXME
# except TokenLimitExceededException as e:
# # HFTextGen
# response = ChatResponse(
# finish_reason=FinishReason.length,
# # NOTE Show the total tokens of the model instead of 0
# # (no token counting currently...)
# total_tokens=self.ai_model.tokens,
# )
except InternalServerError as e:
# OpenAI model error handling.
if e.code == AIModelOpenAI.context_length_exceeded_error:
response = ChatResponse(
finish_reason=FinishReason.length,
total_tokens=self.ai_model.tokens,
total_tokens=new_tokens,
)
else:
raise
except Exception as e:
print(f"There was an unkown error when generating a response: {e}")
exit(1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(SystemMessage(content='System message'), AIMessage(content='OK'))
[HumanMessage(content='Test 1'), AIMessage(content='OK 1'), HumanMessage(content='Test 2'), AIMessage(content='OK 2'), HumanMessage(content='Test 3'), AIMessage(content='OK 3')]
[ChatResponse(message=AIMessage(content='OK 1'), total_tokens=1024, finish_reason=<FinishReason.stop: 1>), ChatResponse(message=AIMessage(content='OK 2'), total_tokens=1024, finish_reason=<FinishReason.stop: 1>), ChatResponse(message=AIMessage(content='OK 3'), total_tokens=1024, finish_reason=<FinishReason.stop: 1>)]
[ChatResponse(message=AIMessage(content='OK 1'), total_tokens=15, finish_reason=<FinishReason.stop: 1>), ChatResponse(message=AIMessage(content='OK 2'), total_tokens=23, finish_reason=<FinishReason.stop: 1>), ChatResponse(message=AIMessage(content='OK 3'), total_tokens=31, finish_reason=<FinishReason.stop: 1>)]

0 comments on commit 8778df9

Please sign in to comment.