mirror of
https://github.com/AI4Finance-Foundation/FinGPT.git
synced 2024-02-15 23:10:01 +03:00
update external LLM to turbo 3.5, instead of davinci; modify prompt
This commit is contained in:
@@ -25,7 +25,7 @@ def extract_classification(text, classification_prompt):
|
||||
},
|
||||
{
|
||||
"role": "user",
|
||||
"content": text + classification_prompt,
|
||||
"content": "We have the following financial statement: \"" + text + "\"" + classification_prompt,
|
||||
}
|
||||
],
|
||||
}
|
||||
@@ -36,7 +36,18 @@ def extract_classification(text, classification_prompt):
|
||||
response = requests.post(api_url, headers=headers, json=payload)
|
||||
json_data = response.json()
|
||||
print("json data", json_data)
|
||||
classification_response = json_data[0]['text'].strip()
|
||||
classification_response = json_data["choices"][0]['message']['content'].strip()
|
||||
if "Twitter" in classification_response:
|
||||
classification_response = "Twitter"
|
||||
elif "Seeking Alpha" in classification_response:
|
||||
classification_response = "Seeking Alpha"
|
||||
elif "Reuters" in classification_response:
|
||||
classification_response = "Reuters"
|
||||
elif "WSJ" in classification_response:
|
||||
classification_response = "WSJ"
|
||||
else:
|
||||
classification_response = "Unknown"
|
||||
|
||||
print("Classification response:", classification_response)
|
||||
return classification_response
|
||||
except requests.exceptions.RequestException as e:
|
||||
|
||||
@@ -656,7 +656,7 @@ def select_column_and_classify():
|
||||
raise ValueError("Invalid column selection")
|
||||
|
||||
df["classification"] = "" # Create a new column named "classification"
|
||||
default_classification_prompt = ". For news above, determine its origin. Only print \"Twitter\" or \"Seeking Alpha\" or \"Reuters\" or \"WSJ\""
|
||||
default_classification_prompt = ". For financial statement above, determine its origin (based on your existing knowledge). Your answer should be either \"Twitter\" or \"Seeking Alpha\" or \"Reuters\" or \"WSJ\""
|
||||
classification_prompt = gui.enterbox("Modify the classification prompt:", "Custom Classification Prompt",
|
||||
default_classification_prompt)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user