Spaces:
Runtime error
Runtime error
Upload folder using huggingface_hub
Browse files
app/openai_chat_completion.py
CHANGED
@@ -15,7 +15,7 @@ class OpenAIChatCompletions:
|
|
15 |
self.model = model
|
16 |
self.system_message = system_message
|
17 |
|
18 |
-
|
19 |
# function to input args such as model, prompt, etc. and return completion
|
20 |
def openai_chat_completion(self, prompt, n_shot=None):
|
21 |
messages = [{"role": "system", "content": self.system_message}] if self.system_message else []
|
@@ -71,6 +71,10 @@ class OpenAIChatCompletions:
|
|
71 |
|
72 |
# a method that samples n rows from a jsonl file, returning a pandas dataframe
|
73 |
@staticmethod
|
74 |
-
def _sample_jsonl(
|
|
|
|
|
|
|
|
|
75 |
jsonObj = pd.read_json(path_or_buf=path_or_buf, lines=True)
|
76 |
return jsonObj.sample(n_samples, random_state=42)
|
|
|
15 |
self.model = model
|
16 |
self.system_message = system_message
|
17 |
|
18 |
+
|
19 |
# function to input args such as model, prompt, etc. and return completion
|
20 |
def openai_chat_completion(self, prompt, n_shot=None):
|
21 |
messages = [{"role": "system", "content": self.system_message}] if self.system_message else []
|
|
|
71 |
|
72 |
# a method that samples n rows from a jsonl file, returning a pandas dataframe
|
73 |
@staticmethod
|
74 |
+
def _sample_jsonl(
|
75 |
+
# path_or_buf='../data/cookies_train.jsonl',
|
76 |
+
path_or_buf='~/data/cookies_train.jsonl',
|
77 |
+
n_samples=5
|
78 |
+
):
|
79 |
jsonObj = pd.read_json(path_or_buf=path_or_buf, lines=True)
|
80 |
return jsonObj.sample(n_samples, random_state=42)
|