Matias Stager commited on
Commit
4e59b6b
·
1 Parent(s): 7460231

Add Helicone for Analytics

Browse files
Files changed (2) hide show
  1. __pycache__/utils.cpython-311.pyc +0 -0
  2. utils.py +8 -2
__pycache__/utils.cpython-311.pyc CHANGED
Binary files a/__pycache__/utils.cpython-311.pyc and b/__pycache__/utils.cpython-311.pyc differ
 
utils.py CHANGED
@@ -1,4 +1,5 @@
1
  import openai
 
2
 
3
  def get_initial_message():
4
  messages=[
@@ -8,15 +9,20 @@ def get_initial_message():
8
  ]
9
  return messages
10
 
 
 
11
  def get_chatgpt_response(messages, model="gpt-3.5-turbo"):
12
  print("Pregunta: ", messages)
13
  response = openai.ChatCompletion.create(
14
  model=model,
15
- messages=messages
 
 
 
16
  )
17
  print ("respuesta",response)
18
  return response['choices'][0]['message']['content']
19
 
20
  def update_chat(messages, role, content):
21
  messages.append({"role": role, "content": content})
22
- return messages
 
1
  import openai
2
+ import os
3
 
4
  def get_initial_message():
5
  messages=[
 
9
  ]
10
  return messages
11
 
12
+ openai.api_base = "https://oai.hconeai.com/v1"
13
+
14
  def get_chatgpt_response(messages, model="gpt-3.5-turbo"):
15
  print("Pregunta: ", messages)
16
  response = openai.ChatCompletion.create(
17
  model=model,
18
+ messages=messages,
19
+ headers={
20
+ "Helicone-Auth": os.getenv('helicone_key'),
21
+ }
22
  )
23
  print ("respuesta",response)
24
  return response['choices'][0]['message']['content']
25
 
26
  def update_chat(messages, role, content):
27
  messages.append({"role": role, "content": content})
28
+ return messages