ariG23498 HF Staff commited on
Commit
2c47224
·
verified ·
1 Parent(s): a2383a2

Upload openai_gpt-oss-120b_3.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. openai_gpt-oss-120b_3.py +2 -36
openai_gpt-oss-120b_3.py CHANGED
@@ -12,24 +12,7 @@
12
 
13
  try:
14
  import os
15
- from openai import OpenAI
16
-
17
- client = OpenAI(
18
- base_url="https://router.huggingface.co/v1",
19
- api_key=os.environ["HF_TOKEN"],
20
- )
21
-
22
- completion = client.chat.completions.create(
23
- model="openai/gpt-oss-120b",
24
- messages=[
25
- {
26
- "role": "user",
27
- "content": "What is the capital of France?"
28
- }
29
- ],
30
- )
31
-
32
- print(completion.choices[0].message)
33
  with open('openai_gpt-oss-120b_3.txt', 'w', encoding='utf-8') as f:
34
  f.write('Everything was good in openai_gpt-oss-120b_3.txt')
35
  except Exception as e:
@@ -45,24 +28,7 @@ except Exception as e:
45
  import traceback
46
  f.write('''```CODE:
47
  import os
48
- from openai import OpenAI
49
-
50
- client = OpenAI(
51
- base_url="https://router.huggingface.co/v1",
52
- api_key=os.environ["HF_TOKEN"],
53
- )
54
-
55
- completion = client.chat.completions.create(
56
- model="openai/gpt-oss-120b",
57
- messages=[
58
- {
59
- "role": "user",
60
- "content": "What is the capital of France?"
61
- }
62
- ],
63
- )
64
-
65
- print(completion.choices[0].message)
66
  ```
67
 
68
  ERROR:
 
12
 
13
  try:
14
  import os
15
+ os.environ['HF_TOKEN'] = 'YOUR_TOKEN_HERE'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  with open('openai_gpt-oss-120b_3.txt', 'w', encoding='utf-8') as f:
17
  f.write('Everything was good in openai_gpt-oss-120b_3.txt')
18
  except Exception as e:
 
28
  import traceback
29
  f.write('''```CODE:
30
  import os
31
+ os.environ['HF_TOKEN'] = 'YOUR_TOKEN_HERE'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  ```
33
 
34
  ERROR: