rusinopp commited on
Commit
a583c19
·
verified ·
1 Parent(s): 422668a

Upload external_api_engine.py

Browse files
Files changed (1) hide show
  1. external_api_engine.py +5 -3
external_api_engine.py CHANGED
@@ -3,8 +3,9 @@ import requests
3
  import os
4
  from emotion_filter import rewrite_with_persona
5
 
 
 
6
  API_TOKEN = os.getenv("neko")
7
- API_URL = "https://api-inference.huggingface.co/models/rinna/japanese-gpt-neox-3.6b"
8
 
9
  headers = {
10
  "Authorization": f"Bearer {API_TOKEN}"
@@ -15,9 +16,10 @@ def call_external_api(input_text):
15
  payload = {
16
  "inputs": input_text,
17
  "parameters": {
18
- "max_new_tokens": 100,
19
  "temperature": 0.8,
20
- "do_sample": True
 
21
  }
22
  }
23
  response = requests.post(API_URL, headers=headers, json=payload, timeout=30)
 
3
  import os
4
  from emotion_filter import rewrite_with_persona
5
 
6
+ # NIMOモデル(指示応答型)
7
+ API_URL = "https://api-inference.huggingface.co/models/rinna/japanese-gpt-neox-3.6b-instruction-ppo"
8
  API_TOKEN = os.getenv("neko")
 
9
 
10
  headers = {
11
  "Authorization": f"Bearer {API_TOKEN}"
 
16
  payload = {
17
  "inputs": input_text,
18
  "parameters": {
19
+ "max_new_tokens": 160,
20
  "temperature": 0.8,
21
+ "do_sample": True,
22
+ "repetition_penalty": 1.2
23
  }
24
  }
25
  response = requests.post(API_URL, headers=headers, json=payload, timeout=30)