jonathanjordan21 commited on
Commit
251bf73
·
verified ·
1 Parent(s): 65250fd

Update custom_llm.py

Browse files
Files changed (1) hide show
  1. custom_llm.py +24 -0
custom_llm.py CHANGED
@@ -210,6 +210,7 @@ def out_format(text, llm, df):
210
 
211
 
212
  def custom_dataframe_chain(llm, df):
 
213
  prompt = PromptTemplate.from_template("""<s><INST>You have access to a pandas dataframe variable named "df". Below are the examples of the dataframe:
214
 
215
  {df_example}
@@ -226,6 +227,10 @@ def custom_dataframe_chain(llm, df):
226
 
227
 
228
  Do not import pandas and Do not create or re-assign "df" variable
 
 
 
 
229
 
230
 
231
  The output must follow the following example format:
@@ -239,7 +244,26 @@ def custom_dataframe_chain(llm, df):
239
 
240
 
241
 
 
 
242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
 
244
 
245
 
 
210
 
211
 
212
  def custom_dataframe_chain(llm, df):
213
+
214
  prompt = PromptTemplate.from_template("""<s><INST>You have access to a pandas dataframe variable named "df". Below are the examples of the dataframe:
215
 
216
  {df_example}
 
227
 
228
 
229
  Do not import pandas and Do not create or re-assign "df" variable
230
+
231
+
232
+ Below is the unique value of the important categorical columns:
233
+ 1.
234
 
235
 
236
  The output must follow the following example format:
 
244
 
245
 
246
 
247
+ def custom_unique_df_chain(llm, df):
248
+ prompt = PromptTemplate("""<s><INST>You have access to a pandas dataframe variable named "df". Below are the examples of the dataframe:
249
 
250
+ {df_example}
251
+
252
+
253
+ Create unique values for the important non-datetime categorical columns with maximum 20 unique values for each columns. Store the unique values in a variable named "response" with the following format of list of python dictionaries:
254
+
255
+ [{column_name1: [list_of_unique_column1]}, {column_name2: [list_of_unique_values_column2]}]
256
+
257
+
258
+ The output must follow the following example format:
259
+ ```python
260
+ # Generated Code
261
+ ```
262
+
263
+ </INST></s>""", input_variables=["df_example"])
264
+
265
+
266
+ return prompt | llm | RunnableLambda(lambda x:out_format(x, llm, df))
267
 
268
 
269