summaryrefslogtreecommitdiffstats
path: root/unfinished
diff options
context:
space:
mode:
Diffstat (limited to 'unfinished')
-rw-r--r--unfinished/chatpdf/__init__.py75
-rw-r--r--unfinished/openai/README.md2
-rw-r--r--unfinished/openai/__ini__.py87
-rw-r--r--unfinished/vercelai/__init__.py41
-rw-r--r--unfinished/vercelai/test.js33
-rw-r--r--unfinished/vercelai/test.py67
-rw-r--r--unfinished/vercelai/token.py0
-rw-r--r--unfinished/vercelai/v2.py27
-rw-r--r--unfinished/vercelai/vercelai_test.py5
-rw-r--r--unfinished/writesonic/README.md53
-rw-r--r--unfinished/writesonic/__init__.py163
11 files changed, 221 insertions, 332 deletions
diff --git a/unfinished/chatpdf/__init__.py b/unfinished/chatpdf/__init__.py
new file mode 100644
index 00000000..4c9d2d3e
--- /dev/null
+++ b/unfinished/chatpdf/__init__.py
@@ -0,0 +1,75 @@
+import requests
+import json
+
+class Completion:
+
+ def request(prompt: str):
+ '''TODO: some sort of authentication + upload PDF from URL or local file
+ Then you should get the atoken and chat ID
+ '''
+
+ token = "your_token_here"
+ chat_id = "your_chat_id_here"
+
+ url = "https://chat-pr4yueoqha-ue.a.run.app/"
+
+ payload = json.dumps({
+ "v": 2,
+ "chatSession": {
+ "type": "join",
+ "chatId": chat_id
+ },
+ "history": [
+ {
+ "id": "VNsSyJIq_0",
+ "author": "p_if2GPSfyN8hjDoA7unYe",
+ "msg": "<start>",
+ "time": 1682672009270
+ },
+ {
+ "id": "Zk8DRUtx_6",
+ "author": "uplaceholder",
+ "msg": prompt,
+ "time": 1682672181339
+ }
+ ]
+ })
+
+ # TODO: fix headers, use random user-agent, streaming response, etc
+ headers = {
+ 'authority': 'chat-pr4yueoqha-ue.a.run.app',
+ 'accept': '*/*',
+ 'accept-language': 'en-US,en;q=0.9',
+ 'atoken': token,
+ 'content-type': 'application/json',
+ 'origin': 'https://www.chatpdf.com',
+ 'referer': 'https://www.chatpdf.com/',
+ 'sec-ch-ua': '"Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"',
+ 'sec-ch-ua-mobile': '?0',
+ 'sec-ch-ua-platform': '"Windows"',
+ 'sec-fetch-dest': 'empty',
+ 'sec-fetch-mode': 'cors',
+ 'sec-fetch-site': 'cross-site',
+ 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'
+ }
+
+ response = requests.request("POST", url, headers=headers, data=payload).text
+ Completion.stream_completed = True
+ return {'response': response}
+
+ @staticmethod
+ def create(prompt: str):
+ Thread(target=Completion.request, args=[prompt]).start()
+
+ while Completion.stream_completed != True or not Completion.message_queue.empty():
+ try:
+ message = Completion.message_queue.get(timeout=0.01)
+ for message in findall(Completion.regex, message):
+ yield loads(Completion.part1 + message + Completion.part2)['delta']
+
+ except Empty:
+ pass
+
+ @staticmethod
+ def handle_stream_response(response):
+ Completion.message_queue.put(response.decode())
diff --git a/unfinished/openai/README.md b/unfinished/openai/README.md
deleted file mode 100644
index 67e8645c..00000000
--- a/unfinished/openai/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-to do:
-- code refractoring \ No newline at end of file
diff --git a/unfinished/openai/__ini__.py b/unfinished/openai/__ini__.py
deleted file mode 100644
index f0894e1b..00000000
--- a/unfinished/openai/__ini__.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# Import required libraries
-from uuid import uuid4
-
-from browser_cookie3 import chrome
-from tls_client import Session
-
-
-class OpenAIChat:
- def __init__(self):
- self.client = Session(client_identifier='chrome110')
- self._load_cookies()
- self._set_headers()
-
- def _load_cookies(self):
- # Load cookies for the specified domain
- for cookie in chrome(domain_name='chat.openai.com'):
- self.client.cookies[cookie.name] = cookie.value
-
- def _set_headers(self):
- # Set headers for the client
- self.client.headers = {
- 'authority': 'chat.openai.com',
- 'accept': 'text/event-stream',
- 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3',
- 'authorization': 'Bearer ' + self.session_auth()['accessToken'],
- 'cache-control': 'no-cache',
- 'content-type': 'application/json',
- 'origin': 'https://chat.openai.com',
- 'pragma': 'no-cache',
- 'referer': 'https://chat.openai.com/chat',
- 'sec-ch-ua': '"Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"',
- 'sec-ch-ua-mobile': '?0',
- 'sec-ch-ua-platform': '"macOS"',
- 'sec-fetch-dest': 'empty',
- 'sec-fetch-mode': 'cors',
- 'sec-fetch-site': 'same-origin',
- 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36',
- }
-
- def session_auth(self):
- headers = {
- 'authority': 'chat.openai.com',
- 'accept': '*/*',
- 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3',
- 'cache-control': 'no-cache',
- 'pragma': 'no-cache',
- 'referer': 'https://chat.openai.com/chat',
- 'sec-ch-ua': '"Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"',
- 'sec-ch-ua-mobile': '?0',
- 'sec-ch-ua-platform': '"macOS"',
- 'sec-fetch-dest': 'empty',
- 'sec-fetch-mode': 'cors',
- 'sec-fetch-site': 'same-origin',
- 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36',
- }
-
- return self.client.get('https://chat.openai.com/api/auth/session', headers=headers).json()
-
- def send_message(self, message):
- response = self.client.post('https://chat.openai.com/backend-api/conversation', json={
- 'action': 'next',
- 'messages': [
- {
- 'id': str(uuid4()),
- 'author': {
- 'role': 'user',
- },
- 'content': {
- 'content_type': 'text',
- 'parts': [
- message,
- ],
- },
- },
- ],
- 'parent_message_id': '9b4682f7-977c-4c8a-b5e6-9713e73dfe01',
- 'model': 'text-davinci-002-render-sha',
- 'timezone_offset_min': -120,
- })
-
- return response.text
-
-
-if __name__ == "__main__":
- chat = OpenAIChat()
- response = chat.send_message("hello world")
- print(response)
diff --git a/unfinished/vercelai/__init__.py b/unfinished/vercelai/__init__.py
new file mode 100644
index 00000000..1dcb5b39
--- /dev/null
+++ b/unfinished/vercelai/__init__.py
@@ -0,0 +1,41 @@
+import requests
+
+class Completion:
+ def create(prompt: str,
+ model: str = 'openai:gpt-3.5-turbo',
+ temperature: float = 0.7,
+ max_tokens: int = 200,
+ top_p: float = 1,
+ top_k: int = 1,
+ frequency_penalty: float = 1,
+ presence_penalty: float = 1,
+ stopSequences: list = []):
+
+ token = requests.get('https://play.vercel.ai/openai.jpeg', headers={
+ 'authority': 'play.vercel.ai',
+ 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3',
+ 'referer': 'https://play.vercel.ai/',
+ 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'}).text.replace('=','')
+
+ print(token)
+
+ headers = {
+ 'authority': 'play.vercel.ai',
+ 'custom-encoding': token,
+ 'origin': 'https://play.vercel.ai',
+ 'referer': 'https://play.vercel.ai/',
+ 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'
+ }
+
+ for chunk in requests.post('https://play.vercel.ai/api/generate', headers=headers, stream=True, json={
+ 'prompt': prompt,
+ 'model': model,
+ 'temperature': temperature,
+ 'maxTokens': max_tokens,
+ 'topK': top_p,
+ 'topP': top_k,
+ 'frequencyPenalty': frequency_penalty,
+ 'presencePenalty': presence_penalty,
+ 'stopSequences': stopSequences}).iter_lines():
+
+ yield (chunk) \ No newline at end of file
diff --git a/unfinished/vercelai/test.js b/unfinished/vercelai/test.js
new file mode 100644
index 00000000..0f822cfd
--- /dev/null
+++ b/unfinished/vercelai/test.js
@@ -0,0 +1,33 @@
+(async () => {
+
+ let response = await fetch("https://play.vercel.ai/openai.jpeg", {
+ "headers": {
+ "accept": "*/*",
+ "accept-language": "en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3",
+ "sec-ch-ua": "\"Chromium\";v=\"112\", \"Google Chrome\";v=\"112\", \"Not:A-Brand\";v=\"99\"",
+ "sec-ch-ua-mobile": "?0",
+ "sec-ch-ua-platform": "\"macOS\"",
+ "sec-fetch-dest": "empty",
+ "sec-fetch-mode": "cors",
+ "sec-fetch-site": "same-origin"
+ },
+ "referrer": "https://play.vercel.ai/",
+ "referrerPolicy": "strict-origin-when-cross-origin",
+ "body": null,
+ "method": "GET",
+ "mode": "cors",
+ "credentials": "omit"
+ });
+
+
+ let data = JSON.parse(atob(await response.text()))
+ let ret = eval("(".concat(data.c, ")(data.a)"));
+
+ botPreventionToken = btoa(JSON.stringify({
+ r: ret,
+ t: data.t
+ }))
+
+ console.log(botPreventionToken);
+
+})() \ No newline at end of file
diff --git a/unfinished/vercelai/test.py b/unfinished/vercelai/test.py
new file mode 100644
index 00000000..318e71c3
--- /dev/null
+++ b/unfinished/vercelai/test.py
@@ -0,0 +1,67 @@
+import requests
+from base64 import b64decode, b64encode
+from json import loads
+from json import dumps
+
+headers = {
+ 'Accept': '*/*',
+ 'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8',
+ 'Connection': 'keep-alive',
+ 'Referer': 'https://play.vercel.ai/',
+ 'Sec-Fetch-Dest': 'empty',
+ 'Sec-Fetch-Mode': 'cors',
+ 'Sec-Fetch-Site': 'same-origin',
+ 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36',
+ 'sec-ch-ua': '"Chromium";v="110", "Google Chrome";v="110", "Not:A-Brand";v="99"',
+ 'sec-ch-ua-mobile': '?0',
+ 'sec-ch-ua-platform': '"macOS"',
+}
+
+response = requests.get('https://play.vercel.ai/openai.jpeg', headers=headers)
+
+token_data = loads(b64decode(response.text))
+print(token_data)
+
+raw_token = {
+ 'a': token_data['a'] * .1 * .2,
+ 't': token_data['t']
+}
+
+print(raw_token)
+
+new_token = b64encode(dumps(raw_token, separators=(',', ':')).encode()).decode()
+print(new_token)
+
+import requests
+
+headers = {
+ 'authority': 'play.vercel.ai',
+ 'accept': '*/*',
+ 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3',
+ 'content-type': 'application/json',
+ 'custom-encoding': new_token,
+ 'origin': 'https://play.vercel.ai',
+ 'referer': 'https://play.vercel.ai/',
+ 'sec-ch-ua': '"Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"',
+ 'sec-ch-ua-mobile': '?0',
+ 'sec-ch-ua-platform': '"macOS"',
+ 'sec-fetch-dest': 'empty',
+ 'sec-fetch-mode': 'cors',
+ 'sec-fetch-site': 'same-origin',
+ 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36',
+}
+
+json_data = {
+ 'prompt': 'hello\n',
+ 'model': 'openai:gpt-3.5-turbo',
+ 'temperature': 0.7,
+ 'maxTokens': 200,
+ 'topK': 1,
+ 'topP': 1,
+ 'frequencyPenalty': 1,
+ 'presencePenalty': 1,
+ 'stopSequences': [],
+}
+
+response = requests.post('https://play.vercel.ai/api/generate', headers=headers, json=json_data)
+print(response.text) \ No newline at end of file
diff --git a/unfinished/vercelai/token.py b/unfinished/vercelai/token.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/unfinished/vercelai/token.py
diff --git a/unfinished/vercelai/v2.py b/unfinished/vercelai/v2.py
deleted file mode 100644
index 176ee342..00000000
--- a/unfinished/vercelai/v2.py
+++ /dev/null
@@ -1,27 +0,0 @@
-import requests
-
-token = requests.get('https://play.vercel.ai/openai.jpeg', headers={
- 'authority': 'play.vercel.ai',
- 'accept-language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3',
- 'referer': 'https://play.vercel.ai/',
- 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'}).text + '.'
-
-headers = {
- 'authority': 'play.vercel.ai',
- 'custom-encoding': token,
- 'origin': 'https://play.vercel.ai',
- 'referer': 'https://play.vercel.ai/',
- 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'
-}
-
-for chunk in requests.post('https://play.vercel.ai/api/generate', headers=headers, stream=True, json={
- 'prompt': 'hi',
- 'model': 'openai:gpt-3.5-turbo',
- 'temperature': 0.7,
- 'maxTokens': 200,
- 'topK': 1,
- 'topP': 1,
- 'frequencyPenalty': 1,
- 'presencePenalty': 1,
- 'stopSequences': []}).iter_lines():
- print(chunk)
diff --git a/unfinished/vercelai/vercelai_test.py b/unfinished/vercelai/vercelai_test.py
new file mode 100644
index 00000000..24cbe0bc
--- /dev/null
+++ b/unfinished/vercelai/vercelai_test.py
@@ -0,0 +1,5 @@
+import vercelai
+
+for token in vercelai.Completion.create('summarize the gnu gpl 1.0'):
+ print(token, end='', flush=True)
+
diff --git a/unfinished/writesonic/README.md b/unfinished/writesonic/README.md
deleted file mode 100644
index a658a87c..00000000
--- a/unfinished/writesonic/README.md
+++ /dev/null
@@ -1,53 +0,0 @@
-### Example: `writesonic` (use like openai pypi package) <a name="example-writesonic"></a>
-
-```python
-# import writesonic
-import writesonic
-
-# create account (3-4s)
-account = writesonic.Account.create(logging = True)
-
-# with loging:
- # 2023-04-06 21:50:25 INFO __main__ -> register success : '{"id":"51aa0809-3053-44f7-922a...' (2s)
- # 2023-04-06 21:50:25 INFO __main__ -> id : '51aa0809-3053-44f7-922a-2b85d8d07edf'
- # 2023-04-06 21:50:25 INFO __main__ -> token : 'eyJhbGciOiJIUzI1NiIsInR5cCI6Ik...'
- # 2023-04-06 21:50:28 INFO __main__ -> got key : '194158c4-d249-4be0-82c6-5049e869533c' (2s)
-
-# simple completion
-response = writesonic.Completion.create(
- api_key = account.key,
- prompt = 'hello world'
-)
-
-print(response.completion.choices[0].text) # Hello! How may I assist you today?
-
-# conversation
-
-response = writesonic.Completion.create(
- api_key = account.key,
- prompt = 'what is my name ?',
- enable_memory = True,
- history_data = [
- {
- 'is_sent': True,
- 'message': 'my name is Tekky'
- },
- {
- 'is_sent': False,
- 'message': 'hello Tekky'
- }
- ]
-)
-
-print(response.completion.choices[0].text) # Your name is Tekky.
-
-# enable internet
-
-response = writesonic.Completion.create(
- api_key = account.key,
- prompt = 'who won the quatar world cup ?',
- enable_google_results = True
-)
-
-print(response.completion.choices[0].text) # Argentina won the 2022 FIFA World Cup tournament held in Qatar ...
-``` \ No newline at end of file
diff --git a/unfinished/writesonic/__init__.py b/unfinished/writesonic/__init__.py
deleted file mode 100644
index ce684912..00000000
--- a/unfinished/writesonic/__init__.py
+++ /dev/null
@@ -1,163 +0,0 @@
-from random import choice
-from time import time
-
-from colorama import Fore, init;
-from names import get_first_name, get_last_name
-from requests import Session
-from requests import post
-
-init()
-
-
-class logger:
- @staticmethod
- def info(string) -> print:
- import datetime
- now = datetime.datetime.now()
- return print(
- f"{Fore.CYAN}{now.strftime('%Y-%m-%d %H:%M:%S')} {Fore.BLUE}INFO {Fore.MAGENTA}__main__ -> {Fore.RESET}{string}")
-
-
-class SonicResponse:
- class Completion:
- class Choices:
- def __init__(self, choice: dict) -> None:
- self.text = choice['text']
- self.content = self.text.encode()
- self.index = choice['index']
- self.logprobs = choice['logprobs']
- self.finish_reason = choice['finish_reason']
-
- def __repr__(self) -> str:
- return f'''<__main__.APIResponse.Completion.Choices(\n text = {self.text.encode()},\n index = {self.index},\n logprobs = {self.logprobs},\n finish_reason = {self.finish_reason})object at 0x1337>'''
-
- def __init__(self, choices: dict) -> None:
- self.choices = [self.Choices(choice) for choice in choices]
-
- class Usage:
- def __init__(self, usage_dict: dict) -> None:
- self.prompt_tokens = usage_dict['prompt_chars']
- self.completion_tokens = usage_dict['completion_chars']
- self.total_tokens = usage_dict['total_chars']
-
- def __repr__(self):
- return f'''<__main__.APIResponse.Usage(\n prompt_tokens = {self.prompt_tokens},\n completion_tokens = {self.completion_tokens},\n total_tokens = {self.total_tokens})object at 0x1337>'''
-
- def __init__(self, response_dict: dict) -> None:
- self.response_dict = response_dict
- self.id = response_dict['id']
- self.object = response_dict['object']
- self.created = response_dict['created']
- self.model = response_dict['model']
- self.completion = self.Completion(response_dict['choices'])
- self.usage = self.Usage(response_dict['usage'])
-
- def json(self) -> dict:
- return self.response_dict
-
-
-class Account:
- session = Session()
- session.headers = {
- "connection": "keep-alive",
- "sec-ch-ua": "\"Not_A Brand\";v=\"99\", \"Google Chrome\";v=\"109\", \"Chromium\";v=\"109\"",
- "accept": "application/json, text/plain, */*",
- "content-type": "application/json",
- "sec-ch-ua-mobile": "?0",
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
- "sec-ch-ua-platform": "\"Windows\"",
- "sec-fetch-site": "same-origin",
- "sec-fetch-mode": "cors",
- "sec-fetch-dest": "empty",
- # "accept-encoding" : "gzip, deflate, br",
- "accept-language": "en-GB,en-US;q=0.9,en;q=0.8",
- "cookie": ""
- }
-
- @staticmethod
- def get_user():
- password = f'0opsYouGoTme@1234'
- f_name = get_first_name()
- l_name = get_last_name()
- hosts = ['gmail.com', 'protonmail.com', 'proton.me', 'outlook.com']
-
- return {
- "email": f"{f_name.lower()}.{l_name.lower()}@{choice(hosts)}",
- "password": password,
- "confirm_password": password,
- "full_name": f'{f_name} {l_name}'
- }
-
- @staticmethod
- def create(logging: bool = False):
- while True:
- try:
- user = Account.get_user()
- start = time()
- response = Account.session.post("https://app.writesonic.com/api/session-login", json=user | {
- "utmParams": "{}",
- "visitorId": "0",
- "locale": "en",
- "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
- "signInWith": "password",
- "request_type": "signup",
- })
-
- if logging:
- logger.info(f"\x1b[31mregister success\x1b[0m : '{response.text[:30]}...' ({int(time() - start)}s)")
- logger.info(f"\x1b[31mid\x1b[0m : '{response.json()['id']}'")
- logger.info(f"\x1b[31mtoken\x1b[0m : '{response.json()['token'][:30]}...'")
-
- start = time()
- response = Account.session.post("https://api.writesonic.com/v1/business/set-business-active",
- headers={"authorization": "Bearer " + response.json()['token']})
- key = response.json()["business"]["api_key"]
- if logging: logger.info(f"\x1b[31mgot key\x1b[0m : '{key}' ({int(time() - start)}s)")
-
- return Account.AccountResponse(user['email'], user['password'], key)
-
- except Exception as e:
- if logging: logger.info(f"\x1b[31merror\x1b[0m : '{e}'")
- continue
-
- class AccountResponse:
- def __init__(self, email, password, key):
- self.email = email
- self.password = password
- self.key = key
-
-
-class Completion:
- def create(
- api_key: str,
- prompt: str,
- enable_memory: bool = False,
- enable_google_results: bool = False,
- history_data: list = []) -> SonicResponse:
- response = post('https://api.writesonic.com/v2/business/content/chatsonic?engine=premium',
- headers={"X-API-KEY": api_key},
- json={
- "enable_memory": enable_memory,
- "enable_google_results": enable_google_results,
- "input_text": prompt,
- "history_data": history_data}).json()
-
- return SonicResponse({
- 'id': f'cmpl-premium-{int(time())}',
- 'object': 'text_completion',
- 'created': int(time()),
- 'model': 'premium',
-
- 'choices': [{
- 'text': response['message'],
- 'index': 0,
- 'logprobs': None,
- 'finish_reason': 'stop'
- }],
-
- 'usage': {
- 'prompt_chars': len(prompt),
- 'completion_chars': len(response['message']),
- 'total_chars': len(prompt) + len(response['message'])
- }
- })