Delete Message typed dict
This commit is contained in:
@@ -2,7 +2,6 @@ from typing import List
|
||||
|
||||
from jarvis import CFG
|
||||
from jarvis.gpt import gpt
|
||||
from jarvis.gpt.message import Message
|
||||
from jarvis.logger import logger
|
||||
|
||||
|
||||
@@ -27,7 +26,7 @@ async def acall_ai_function(function: str, args: list, description: str, model:
|
||||
args = [str(arg) if arg is not None else "None" for arg in args]
|
||||
# parse args to comma separated string
|
||||
args: str = ", ".join(args)
|
||||
messages: List[Message] = [
|
||||
messages: List[dict] = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": f"You are now the following python function: ```# {description}"
|
||||
|
||||
@@ -4,7 +4,6 @@ import openai
|
||||
from openai.error import RateLimitError, APIError, Timeout
|
||||
|
||||
from jarvis import CFG
|
||||
from jarvis.gpt.message import Message
|
||||
from jarvis.logger import logger
|
||||
from typing import Callable
|
||||
|
||||
@@ -60,7 +59,7 @@ async def acreate_chat_completion_once(
|
||||
# Overly simple abstraction until we create something better
|
||||
# simple retry mechanism when getting a rate error or a bad gateway
|
||||
async def acreate_chat_completion(
|
||||
messages: list[Message], # type: ignore
|
||||
messages: list[dict],
|
||||
model: str = None,
|
||||
temperature: float = CFG.temperature,
|
||||
max_tokens: int = None,
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
"""Type helpers for working with the OpenAI library"""
|
||||
from typing import TypedDict
|
||||
|
||||
|
||||
class Message(TypedDict):
|
||||
"""OpenAI Message object containing a role and the message content"""
|
||||
|
||||
role: str
|
||||
content: str
|
||||
@@ -5,11 +5,9 @@ from typing import List
|
||||
|
||||
import tiktoken_async
|
||||
|
||||
from jarvis.gpt.message import Message
|
||||
|
||||
|
||||
async def count_message_tokens(
|
||||
messages: List[Message], model: str = "gpt-3.5-turbo-0301"
|
||||
messages: List[dict], model: str = "gpt-3.5-turbo-0301"
|
||||
) -> int:
|
||||
"""
|
||||
Returns the number of tokens used by a list of messages.
|
||||
|
||||
Reference in New Issue
Block a user