Skip to content

Commit

Permalink
docs: rename console log handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
Lerri-Cofannos committed Aug 22, 2023
1 parent bee18f4 commit 8a43935
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sdk-python/omnilogger/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def filter(self, record) -> bool:

if "message='Post details'" in msg:
try:
self.handle_openai_request(msg)
self.extract_prompt_from_request(msg)
except IndexError:
record.msg = "Prompt not found in OpenAI request: " + msg
return True
Expand All @@ -53,7 +53,7 @@ def filter(self, record) -> bool:
return False
return True

def handle_openai_response(self, data: str):
def extract_output_from_response(self, data: str):
output = data.split("body='")[1].split("' headers=")[0]
output = bytes(output, "utf-8").decode("unicode_escape")
output = json.loads(output)
Expand All @@ -66,7 +66,7 @@ def handle_openai_response(self, data: str):
}
send_to_db(self.url, log)

def handle_openai_request(self, data: str):
def extract_prompt_from_request(self, data: str):
self.prompt = data.split('"prompt": "')[1]
self.prompt = self.prompt.split('", "temperature"')[0]

Expand Down

0 comments on commit 8a43935

Please sign in to comment.