YC-Chen commited on
Commit
8972aae
1 Parent(s): e238967

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +21 -10
README.md CHANGED
@@ -41,15 +41,34 @@ The current release version of Breexe-8x7B is v0.1.
41
 
42
  The API is in beta testing. If you are experiencing connectivity issues, please bear with us.
43
 
 
 
44
  Get started here:
45
 
46
  ```python
 
 
47
  from openai import OpenAI
48
 
49
- API_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6ImdlbmVyYWxfcHVibGljIiwibm90ZSI6ImdlbmVyYWwgcHVibGljIn0.kCp68nRw3RSh3jbMm8FvhG0NIkStflgI1wTHLviRPQE'
50
  BASE_URL = 'https://api-mtkresearch.com/v1'
51
  MODEL_NAME = 'BreeXe-8x7B'
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  messages = [
54
  {
55
  'role': 'system',
@@ -61,15 +80,7 @@ messages = [
61
  }
62
  ]
63
 
64
- client = OpenAI(base_url=BASE_URL, api_key=API_KEY)
65
- completion = client.chat.completions.create(
66
- model=MODEL_NAME,
67
- messages=messages,
68
- temperature=0.01,
69
- top_p=0.01,
70
- max_tokens=512
71
- )
72
- response = completion.choices[0].message.content
73
  print(response)
74
  ```
75
 
 
41
 
42
  The API is in beta testing. If you are experiencing connectivity issues, please bear with us.
43
 
44
+ Free trial API key: `'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoyLCJ1c2VybmFtZSI6ImdlbmVyYWxfcHVibGljIiwibm90ZSI6ImdlbmVyYWwgcHVibGljIn0.kCp68nRw3RSh3jbMm8FvhG0NIkStflgI1wTHLviRPQE'`
45
+
46
  Get started here:
47
 
48
  ```python
49
+ import time
50
+
51
  from openai import OpenAI
52
 
53
+ API_KEY = <API_KEY_HERE>
54
  BASE_URL = 'https://api-mtkresearch.com/v1'
55
  MODEL_NAME = 'BreeXe-8x7B'
56
 
57
+ client = OpenAI(base_url=BASE_URL, api_key=API_KEY)
58
+
59
+
60
+ def ask_breexe(messages):
61
+ completion = client.chat.completions.create(
62
+ model=MODEL_NAME,
63
+ messages=messages,
64
+ temperature=0.01,
65
+ top_p=0.01,
66
+ max_tokens=512
67
+ )
68
+ response = completion.choices[0].message.content
69
+ time.sleep(3) # due to a rate limit of 200 requests per 10 minutes
70
+ return response
71
+
72
  messages = [
73
  {
74
  'role': 'system',
 
80
  }
81
  ]
82
 
83
+ response = ask_breexe(messages)
 
 
 
 
 
 
 
 
84
  print(response)
85
  ```
86