Skip to content

Commit

Permalink
fix style error
Browse files Browse the repository at this point in the history
  • Loading branch information
yangbobo2021 committed Jul 11, 2023
1 parent 7cdcc38 commit 0726852
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion devchat/openai/openai_chat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Optional, Union, List, Dict, Iterator
from typing import Optional, Union, List, Dict, Iterator
from pydantic import BaseModel, Field, Extra
import openai
from devchat.chat import Chat
Expand Down
6 changes: 3 additions & 3 deletions devchat/openai/openai_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ def append_new(self, message_type: str, content: str,
self._new_messages[message_type].append(message)
self._request_tokens += num_tokens
return True

def set_functions(self, functions, available_tokens: int = math.inf):
num_tokens = message_tokens({"functions": json.dumps(functions)}, self.model)
if num_tokens > available_tokens:
return False

self._new_messages[Message.FUNCTION] = functions
self._request_tokens += num_tokens
return True

def get_functions(self):
return self._new_messages.get(Message.FUNCTION, None)

Expand Down

0 comments on commit 0726852

Please sign in to comment.