added selection of model
Browse files- gigiachat_requests.py +6 -6
gigiachat_requests.py
CHANGED
@@ -30,11 +30,11 @@ def get_access_token():
|
|
30 |
print('Got access token')
|
31 |
return access_token
|
32 |
|
33 |
-
def get_number_of_tokens(prompt, access_token):
|
34 |
url_completion = os.getenv('GIGA_TOKENS_URL')
|
35 |
|
36 |
data_copm = json.dumps({
|
37 |
-
"model":
|
38 |
"input": [
|
39 |
prompt
|
40 |
],
|
@@ -51,11 +51,11 @@ def get_number_of_tokens(prompt, access_token):
|
|
51 |
|
52 |
return response_data[0]['tokens']
|
53 |
|
54 |
-
def get_completion_from_gigachat(prompt, max_tokens, access_token):
|
55 |
url_completion = os.getenv('GIGA_COMPLETION_URL')
|
56 |
|
57 |
data_copm = json.dumps({
|
58 |
-
"model":
|
59 |
"messages": [
|
60 |
{
|
61 |
"role": "user",
|
@@ -78,11 +78,11 @@ def get_completion_from_gigachat(prompt, max_tokens, access_token):
|
|
78 |
|
79 |
return answer_from_llm
|
80 |
|
81 |
-
def process_transcribation_with_gigachat(prompt, transcript, max_tokens, access_token):
|
82 |
url_completion = os.getenv('GIGA_COMPLETION_URL')
|
83 |
|
84 |
data_copm = json.dumps({
|
85 |
-
"model":
|
86 |
"max_tokens": max_tokens,
|
87 |
"messages": [
|
88 |
{
|
|
|
30 |
print('Got access token')
|
31 |
return access_token
|
32 |
|
33 |
+
def get_number_of_tokens(prompt, access_token, model):
|
34 |
url_completion = os.getenv('GIGA_TOKENS_URL')
|
35 |
|
36 |
data_copm = json.dumps({
|
37 |
+
"model": model,
|
38 |
"input": [
|
39 |
prompt
|
40 |
],
|
|
|
51 |
|
52 |
return response_data[0]['tokens']
|
53 |
|
54 |
+
def get_completion_from_gigachat(prompt, max_tokens, access_token, model):
|
55 |
url_completion = os.getenv('GIGA_COMPLETION_URL')
|
56 |
|
57 |
data_copm = json.dumps({
|
58 |
+
"model": model,
|
59 |
"messages": [
|
60 |
{
|
61 |
"role": "user",
|
|
|
78 |
|
79 |
return answer_from_llm
|
80 |
|
81 |
+
def process_transcribation_with_gigachat(prompt, transcript, max_tokens, access_token, model):
|
82 |
url_completion = os.getenv('GIGA_COMPLETION_URL')
|
83 |
|
84 |
data_copm = json.dumps({
|
85 |
+
"model": model,
|
86 |
"max_tokens": max_tokens,
|
87 |
"messages": [
|
88 |
{
|