ksh123134 commited on
Commit
d488191
1 Parent(s): aa1539a
Files changed (3) hide show
  1. README.md +0 -2
  2. model.py +0 -18
  3. response.py +1 -7
README.md CHANGED
@@ -46,9 +46,7 @@ Get Involved: [Discuss and contribute on GitHub](https://github.com/yanolja/aren
46
  Set your environment variables and run the app:
47
 
48
  ```shell
49
- GOOGLE_CLOUD_PROJECT=<your project id> \
50
  CREDENTIALS_PATH=<your crednetials path> \
51
- MODELS_SECRET=<your secret> \
52
  OPENAI_API_KEY=<your key> \
53
  ANTHROPIC_API_KEY=<your key> \
54
  MISTRAL_API_KEY=<your key> \
 
46
  Set your environment variables and run the app:
47
 
48
  ```shell
 
49
  CREDENTIALS_PATH=<your crednetials path> \
 
50
  OPENAI_API_KEY=<your key> \
51
  ANTHROPIC_API_KEY=<your key> \
52
  MISTRAL_API_KEY=<your key> \
model.py CHANGED
@@ -2,29 +2,11 @@
2
  This module contains functions to interact with the models.
3
  """
4
 
5
- from enum import Enum
6
  import json
7
- import os
8
  from typing import List
9
 
10
- from google.cloud import secretmanager
11
- from google.oauth2 import service_account
12
  import litellm
13
 
14
- from credentials import get_credentials_json
15
-
16
- GOOGLE_CLOUD_PROJECT = os.environ.get("GOOGLE_CLOUD_PROJECT")
17
- MODELS_SECRET = os.environ.get("MODELS_SECRET")
18
-
19
- secretmanager_client = secretmanager.SecretManagerServiceClient(
20
- credentials=service_account.Credentials.from_service_account_info(
21
- get_credentials_json()))
22
- models_secret = secretmanager_client.access_secret_version(
23
- name=secretmanager_client.secret_version_path(GOOGLE_CLOUD_PROJECT,
24
- MODELS_SECRET, "latest"))
25
- decoded_secret = models_secret.payload.data.decode("UTF-8")
26
-
27
-
28
  DEFAULT_SUMMARIZE_INSTRUCTION = "Summarize the given text without changing the language of it." # pylint: disable=line-too-long
29
  DEFAULT_TRANSLATE_INSTRUCTION = "Translate the given text from {source_lang} to {target_lang}." # pylint: disable=line-too-long
30
 
 
2
  This module contains functions to interact with the models.
3
  """
4
 
 
5
  import json
 
6
  from typing import List
7
 
 
 
8
  import litellm
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  DEFAULT_SUMMARIZE_INSTRUCTION = "Summarize the given text without changing the language of it." # pylint: disable=line-too-long
11
  DEFAULT_TRANSLATE_INSTRUCTION = "Translate the given text from {source_lang} to {target_lang}." # pylint: disable=line-too-long
12
 
response.py CHANGED
@@ -77,13 +77,7 @@ def get_responses(prompt: str, category: str, source_lang: str,
77
  instruction = get_instruction(category, model, source_lang, target_lang)
78
  try:
79
  # TODO(#1): Allow user to set configuration.
80
- response = model.completion(messages=[{
81
- "role": "system",
82
- "content": instruction
83
- }, {
84
- "role": "user",
85
- "content": prompt
86
- }])
87
  create_history(category, model.name, instruction, prompt, response)
88
  responses.append(response)
89
 
 
77
  instruction = get_instruction(category, model, source_lang, target_lang)
78
  try:
79
  # TODO(#1): Allow user to set configuration.
80
+ response = model.completion(instruction, prompt)
 
 
 
 
 
 
81
  create_history(category, model.name, instruction, prompt, response)
82
  responses.append(response)
83