naveenvenkatesh commited on
Commit
333434e
1 Parent(s): 2575920

Update Tags_Extractor.py

Browse files
Files changed (1) hide show
  1. Tags_Extractor.py +9 -5
Tags_Extractor.py CHANGED
@@ -10,10 +10,10 @@ class Tags:
10
  # openai.api_base = os.getenv['api_base']
11
  # openai.api_version = os.getenv['api_version']
12
  # openai.api_key = os.getenv['api_key']
13
- self.client = AzureOpenAI(api_key=os.getenv("AZURE_OPENAI_KEY"),
14
- api_version="2023-07-01-preview",
15
- azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
16
- )
17
 
18
 
19
  def extract_tags(self,extracted_summary):
@@ -24,6 +24,10 @@ class Tags:
24
  str: Extracted tags.
25
  """
26
  try:
 
 
 
 
27
 
28
  conversation = [
29
  {"role": "system", "content": "You are a helpful Tags Extracter."},
@@ -31,7 +35,7 @@ class Tags:
31
  ]
32
 
33
  # Call OpenAI GPT-3.5-turbo
34
- chat_completion = self.client.chat.completions.create(
35
  model = "ChatGPT",
36
  messages = conversation,
37
  max_tokens=1000,
 
10
  # openai.api_base = os.getenv['api_base']
11
  # openai.api_version = os.getenv['api_version']
12
  # openai.api_key = os.getenv['api_key']
13
+ # self.client = AzureOpenAI(api_key=os.getenv("AZURE_OPENAI_KEY"),
14
+ # api_version="2023-07-01-preview",
15
+ # azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
16
+ # )
17
 
18
 
19
  def extract_tags(self,extracted_summary):
 
24
  str: Extracted tags.
25
  """
26
  try:
27
+ client = AzureOpenAI(api_key=os.getenv("AZURE_OPENAI_KEY"),
28
+ api_version="2023-07-01-preview",
29
+ azure_endpoint = os.getenv("AZURE_OPENAI_ENDPOINT")
30
+ )
31
 
32
  conversation = [
33
  {"role": "system", "content": "You are a helpful Tags Extracter."},
 
35
  ]
36
 
37
  # Call OpenAI GPT-3.5-turbo
38
+ chat_completion = client.chat.completions.create(
39
  model = "ChatGPT",
40
  messages = conversation,
41
  max_tokens=1000,