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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model: PipableAI/pip-library-etl-1.3b
|
3 |
+
inference: true
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
library_name: transformers
|
7 |
+
license: apache-2.0
|
8 |
+
metrics:
|
9 |
+
- accuracy
|
10 |
+
model_creator: PipableAI
|
11 |
+
model_name: pip-library-etl-1.3b
|
12 |
+
pipeline_tag: text-generation
|
13 |
+
quantized_by: afrideva
|
14 |
+
tags:
|
15 |
+
- python
|
16 |
+
- java
|
17 |
+
- cpp
|
18 |
+
- sql
|
19 |
+
- function calling
|
20 |
+
- unit tests
|
21 |
+
- causalLM
|
22 |
+
- codeLLAMA modified archi
|
23 |
+
- document
|
24 |
+
- code
|
25 |
+
- code2doc
|
26 |
+
- instruction_tuned
|
27 |
+
- basemodel
|
28 |
+
- pytorch
|
29 |
+
- docstring
|
30 |
+
- documentation
|
31 |
+
- text-generation-inference
|
32 |
+
- gguf
|
33 |
+
- ggml
|
34 |
+
- quantized
|
35 |
+
widget:
|
36 |
+
- example_title: example
|
37 |
+
text: '<example_response>--code:def function_divide2(x): return x / 2--question:Document
|
38 |
+
the code--doc:Description:This function takes a number and divides it by 2.Parameters:-
|
39 |
+
x (numeric): The input value to be divided by 2.Returns:- float: The result of
|
40 |
+
x divided by 2.Example:To call the function, use the following code:function_divide2(1.0)</example_response><function_code>def
|
41 |
+
_plot_bounding_polygon(polygons_coordinates, output_html_path=bounding_polygon_map.html):map_center
|
42 |
+
= [sum([coord[0]for polygon_coords in polygons_coordinatesfor coord in polygon_coords])/
|
43 |
+
sum([len(polygon_coords) for polygon_coords in polygons_coordinates]),sum([coord[1]for
|
44 |
+
polygon_coords in polygons_coordinatesfor coord in polygon_coords])/ sum([len(polygon_coords)
|
45 |
+
for polygon_coords in polygons_coordinates]),]my_map = folium.Map(location=map_center,
|
46 |
+
zoom_start=12)for polygon_coords in polygons_coordinates:folium.Polygon(locations=polygon_coords,color=blue,fill=True,fill_color=blue,fill_opacity=0.2,).add_to(my_map)marker_cluster
|
47 |
+
= MarkerCluster().add_to(my_map)for polygon_coords in polygons_coordinates:for
|
48 |
+
coord in polygon_coords:folium.Marker(location=[coord[0], coord[1]], popup=fCoordinates:
|
49 |
+
{coord}).add_to(marker_cluster)draw = Draw(export=True)draw.add_to(my_map)my_map.save(output_html_path)return
|
50 |
+
output_html_path</function_code><question>Document the python code above giving
|
51 |
+
function description ,parameters and return type and example how to call the function</question><doc>'
|
52 |
+
---
|
53 |
+
|
54 |
+
# pip-library-etl-1.3b-GGUF
|
55 |
+
|
56 |
+
Quantized GGUF model files for [pip-library-etl-1.3b](https://huggingface.co/PipableAI/pip-library-etl-1.3b) from [PipableAI](https://huggingface.co/PipableAI)
|
57 |
+
|
58 |
+
## Original Model Card:
|
59 |
+
|
60 |
+
# pip-library-etl-1.3b
|
61 |
+
|
62 |
+
[pipableAi](https://www.pipable.ai/)
|
63 |
+
|
64 |
+
[colab_notebook](https://colab.research.google.com/drive/10av3SxFf0Psx_IkmZbcUhiVznStV5pVS?usp=sharing)
|
65 |
+
|
66 |
+
[pip etl](https://github.com/PipableAI/pip-library-etl)
|
67 |
+
|
68 |
+
|
69 |
+
|
70 |
+
## How we built it?
|
71 |
+
|
72 |
+
We used softmax cross entropy and a modified form of policy grad along with Q loss, optimized in an EM set up.
|
73 |
+
The performance for the metioned tasks are comparable to much bigger LLMs and GPT-3.5
|
74 |
+
|
75 |
+
## License
|
76 |
+
|
77 |
+
The model is open source under apache 2.0. License
|
78 |
+
|
79 |
+
## Usage
|
80 |
+
|
81 |
+
### NOTE:
|
82 |
+
|
83 |
+
|
84 |
+
If you wish to try this model without utilizing your GPU, we have hosted the model on our end. To execute the library using the hosted playground model, initialize the generator as shown below:
|
85 |
+
|
86 |
+
```python
|
87 |
+
from pip_library_etl import PipEtl
|
88 |
+
|
89 |
+
generator = PipEtl(device="cloud")
|
90 |
+
```
|
91 |
+
|
92 |
+
We have hosted the model at https://playground.pipable.ai/infer. Hence, one can also make a POST request to this endpoint with the following payload:
|
93 |
+
|
94 |
+
```json
|
95 |
+
{
|
96 |
+
"model_name": "PipableAI/pip-library-etl-1.3b",
|
97 |
+
"prompt": "prompt",
|
98 |
+
"max_new_tokens": "400"
|
99 |
+
}
|
100 |
+
```
|
101 |
+
|
102 |
+
```bash
|
103 |
+
curl -X 'POST' \
|
104 |
+
'https://playground.pipable.ai/infer' \
|
105 |
+
-H 'accept: application/json' \
|
106 |
+
-H 'Content-Type: application/x-www-form-urlencoded' \
|
107 |
+
-d 'model_name=PipableAI%2Fpip-library-etl-1.3b&prompt="YOUR PROMPT"&max_new_tokens=400'
|
108 |
+
```
|
109 |
+
|
110 |
+
Alternatively, you can directly access UI endpoint at https://playground.pipable.ai/docs#/default/infer_infer_post.
|
111 |
+
|
112 |
+
### Library use
|
113 |
+
|
114 |
+
For directly using the capabilities of model without putting extra efforts on schems and prompts try to use [pip library_etl](https://github.com/PipableAI/pip-library-etl.git).
|
115 |
+
|
116 |
+
Here's a brief overview of what can be achieved using the PipEtl library:
|
117 |
+
|
118 |
+
- `Function Call Generation` : The generate_function_call method facilitates the generation of Python function calls based on provided questions and either docstrings or undocumented code. This feature can be useful for generating example function calls or for prototyping code snippets.
|
119 |
+
- `Automated Documentation Generation` : With the generate_docstring method, users can automatically generate comprehensive docstrings for Python functions. This feature aids in maintaining well-documented codebases and adhering to best practices.
|
120 |
+
- `Module Documentation` : The generate_module_docstrings method allows for generating documentation for all methods and functions within a given module or package. This capability streamlines the documentation process, especially for large codebases with numerous functions.
|
121 |
+
- `SQL Query Generation` : Users can leverage the generate_sql method to automatically generate SQL queries based on provided schemas and questions. This functionality simplifies the process of creating SQL queries, particularly for data-related tasks.
|
122 |
+
|
123 |
+
For detailed usage refer to the [colab_notebook](https://colab.research.google.com/drive/17PyMU_3QN9LROy7x-jmaema0cuLRzBvc?usp=sharing)
|
124 |
+
|
125 |
+
|
126 |
+
### Installation
|
127 |
+
|
128 |
+
```bash
|
129 |
+
pip install transformers
|
130 |
+
```
|
131 |
+
|
132 |
+
### Prompt
|
133 |
+
```python
|
134 |
+
prompt = f"""<example_response>{--question , --query}</example_response><function_code>{code}</function_code>
|
135 |
+
<question>Give one line description of the python code above in natural language.</question>
|
136 |
+
<doc>"""
|
137 |
+
|
138 |
+
prompt = f"""<example_response>{example of some --question: , --query}</example_response><schema>{schema with cols described}</schema>
|
139 |
+
<question>Write a sql query to ....</question>
|
140 |
+
<sql>"""
|
141 |
+
```
|
142 |
+
|
143 |
+
### PyTorch
|
144 |
+
```python
|
145 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
146 |
+
device = "cuda"
|
147 |
+
model = AutoModelForCausalLM.from_pretrained("PipableAI/pip-library-etl-1.3b").to(device)
|
148 |
+
tokenizer = AutoTokenizer.from_pretrained("PipableAI/pip-library-etl-1.3b")
|
149 |
+
prompt = f"""
|
150 |
+
<example_response>
|
151 |
+
--code:def divide_by_two(x: float) -> float: return x / 2
|
152 |
+
--question:Document the python code above giving function description ,parameters and return type and example on how to call the function
|
153 |
+
--doc:
|
154 |
+
Description: This function divides a given number by 2.
|
155 |
+
Parameters:
|
156 |
+
- x (float): The input value to be divided by 2.
|
157 |
+
Returns:
|
158 |
+
- float: The result of x divided by 2.
|
159 |
+
Example:
|
160 |
+
divide_by_two(1.0)
|
161 |
+
</example_response>
|
162 |
+
<function_code>
|
163 |
+
def download_file(shared_url, destination):
|
164 |
+
try:
|
165 |
+
if not shared_url.startswith("https://drive.google.com"):
|
166 |
+
raise ValueError("Please provde a valid google drive link.")
|
167 |
+
file_id = shared_url.split("/d/")[1]
|
168 |
+
file_id = file_id.split("/")[0]
|
169 |
+
url = f"https://drive.google.com/uc?id={file_id}"
|
170 |
+
gdown.download(url, destination, quiet=False)
|
171 |
+
except Exception as e:
|
172 |
+
print(f"Error downloading file from Google Drive as {e}")
|
173 |
+
raise e
|
174 |
+
</function_code>
|
175 |
+
<instructions>
|
176 |
+
1. In the examples while calling function use the name mentioned after `def ` in the above function_code.
|
177 |
+
2. In the generated docs use valid python type hints as per PEP 484.
|
178 |
+
</instructions>
|
179 |
+
<question>Document the python code above giving function description ,parameters and return type and example how to call the function.</question>
|
180 |
+
<doc>
|
181 |
+
"""
|
182 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
183 |
+
outputs = model.generate(**inputs, max_new_tokens=450)
|
184 |
+
doc = (
|
185 |
+
tokenizer.decode(outputs[0], skip_special_tokens=True)
|
186 |
+
.split("<doc>")[-1]
|
187 |
+
.split("</doc>")[0]
|
188 |
+
)
|
189 |
+
doc = (
|
190 |
+
doc.replace("<p>", "")
|
191 |
+
.replace("</p>", "")
|
192 |
+
.replace("<function_description>", "")
|
193 |
+
.replace("</function_description>", "")
|
194 |
+
)
|
195 |
+
print(doc)
|
196 |
+
```
|
197 |
+
|
198 |
+
|
199 |
+
|
200 |
+
## Examples
|
201 |
+
|
202 |
+
### 1. Code Documentation
|
203 |
+
### prompt
|
204 |
+
```python
|
205 |
+
prompt ='''<example_response>
|
206 |
+
--code:def divide_by_two(x: float) -> float: return x / 2
|
207 |
+
--question:Document the python code above giving function description ,parameters and return type and example on how to call the function
|
208 |
+
--doc:
|
209 |
+
Description: This function divides a given number by 2.
|
210 |
+
Parameters:
|
211 |
+
- x (float): The input value to be divided by 2.
|
212 |
+
Returns:
|
213 |
+
- float: The result of x divided by 2.
|
214 |
+
Example:
|
215 |
+
divide_by_two(1.0)
|
216 |
+
</example_response>
|
217 |
+
<function_code>def _plot_bounding_polygon(
|
218 |
+
polygons_coordinates, output_html_path="bounding_polygon_map.html"
|
219 |
+
):
|
220 |
+
# Create a Folium map centered at the average coordinates of all bounding boxes
|
221 |
+
map_center = [
|
222 |
+
sum(
|
223 |
+
[
|
224 |
+
coord[0]
|
225 |
+
for polygon_coords in polygons_coordinates
|
226 |
+
for coord in polygon_coords
|
227 |
+
]
|
228 |
+
)
|
229 |
+
/ sum([len(polygon_coords) for polygon_coords in polygons_coordinates]),
|
230 |
+
sum(
|
231 |
+
[
|
232 |
+
coord[1]
|
233 |
+
for polygon_coords in polygons_coordinates
|
234 |
+
for coord in polygon_coords
|
235 |
+
]
|
236 |
+
)
|
237 |
+
/ sum([len(polygon_coords) for polygon_coords in polygons_coordinates]),
|
238 |
+
]
|
239 |
+
|
240 |
+
my_map = folium.Map(location=map_center, zoom_start=12)
|
241 |
+
|
242 |
+
# Add each bounding polygon to the map
|
243 |
+
for polygon_coords in polygons_coordinates:
|
244 |
+
folium.Polygon(
|
245 |
+
locations=polygon_coords,
|
246 |
+
color="blue",
|
247 |
+
fill=True,
|
248 |
+
fill_color="blue",
|
249 |
+
fill_opacity=0.2,
|
250 |
+
).add_to(my_map)
|
251 |
+
|
252 |
+
# Add bounding boxes as markers to the map
|
253 |
+
marker_cluster = MarkerCluster().add_to(my_map)
|
254 |
+
|
255 |
+
for polygon_coords in polygons_coordinates:
|
256 |
+
for coord in polygon_coords:
|
257 |
+
folium.Marker(
|
258 |
+
location=[coord[0], coord[1]], popup=f"Coordinates: {coord}"
|
259 |
+
).add_to(marker_cluster)
|
260 |
+
|
261 |
+
# Add draw control to allow users to draw additional polygons
|
262 |
+
draw = Draw(export=True)
|
263 |
+
draw.add_to(my_map)
|
264 |
+
|
265 |
+
# Save the map as an HTML file
|
266 |
+
my_map.save(output_html_path)
|
267 |
+
|
268 |
+
return output_html_path
|
269 |
+
</function_code>
|
270 |
+
<instructions>
|
271 |
+
1. In the examples while calling function use the name mentioned after `def ` in the above function_code.
|
272 |
+
2. In the generated docs use valid python type hints as per PEP 484.
|
273 |
+
</instructions>
|
274 |
+
<question>Document the python code above giving function description ,parameters and return type and example how to call the function</question><doc>'''
|
275 |
+
```
|
276 |
+
|
277 |
+
### Response
|
278 |
+
```txt
|
279 |
+
Description:This function generates a map of the bounding polygons and saves it as an HTML file.
|
280 |
+
Parameters:
|
281 |
+
- polygons_coordinates (list of lists of tuples): A list of lists of tuples representing the coordinates of the polygons. Each polygon is a list of coordinates.
|
282 |
+
- output_html_path (str, optional): The path where the HTML file should be saved. Defaults to "bounding_polygon_map.html".
|
283 |
+
Returns:
|
284 |
+
- str: The path to the saved HTML file.
|
285 |
+
Example:
|
286 |
+
To call the function, use the following code:
|
287 |
+
plot_bounding_polygon([[(0, 0), (1, 0), (1, 1), (0, 1)], [(2, 2), (3, 2), (3, 3), (2, 3)]], "my_map.html").
|
288 |
+
```
|
289 |
+
|
290 |
+
|
291 |
+
### 2. SQL Generation
|
292 |
+
### prompt
|
293 |
+
```python
|
294 |
+
prompt = """Generate a simple SQL query from the schema mentioned for the following question.
|
295 |
+
<schema>
|
296 |
+
CREATE TABLE department (
|
297 |
+
Department_ID number, -- Unique identifier for the department
|
298 |
+
Name text, -- Name of the department
|
299 |
+
Creation text, -- Date of creation or establishment
|
300 |
+
Ranking number, -- Ranking of the department
|
301 |
+
Budget_in_Billions number, -- Budget of the department in billions
|
302 |
+
Num_Employees number -- Number of employees in the department
|
303 |
+
);
|
304 |
+
|
305 |
+
CREATE TABLE head (
|
306 |
+
head_ID number, -- Unique identifier for the head
|
307 |
+
name text, -- Name of the head
|
308 |
+
born_state text, -- State where the head was born
|
309 |
+
age number -- Age of the head
|
310 |
+
);
|
311 |
+
|
312 |
+
CREATE TABLE management (
|
313 |
+
department_ID number, -- Foreign key referencing Department_ID in department table
|
314 |
+
head_ID number, -- Foreign key referencing head_ID in head table
|
315 |
+
temporary_acting text -- Indicates if the head is temporarily acting
|
316 |
+
);
|
317 |
+
</schema>
|
318 |
+
<question>What are the names of the heads who are born outside the California state?</question>
|
319 |
+
<sql>
|
320 |
+
"""
|
321 |
+
```
|
322 |
+
|
323 |
+
### response
|
324 |
+
```sql
|
325 |
+
SELECT head.name FROM head WHERE head.born_state <> 'California';
|
326 |
+
```
|
327 |
+
|
328 |
+
### 3. Performance Schema Monitoring
|
329 |
+
### prompt
|
330 |
+
```python
|
331 |
+
prompt = """Generate the SQL query for SkySQL performance schema for the following question.
|
332 |
+
<example>
|
333 |
+
--question: What are the top 10 most frequently used queries/statements?
|
334 |
+
--sql: SELECT DIGEST_TEXT, COUNT(*) as frequency FROM performance_schema.events_statements_summary_by_digest GROUP BY DIGEST_TEXT ORDER BY frequency DESC LIMIT 10;
|
335 |
+
</example>
|
336 |
+
<schema>
|
337 |
+
CREATE TABLE `accounts` (`USER` char(128) DEFAULT NULL -- 'The connection''s client user name for the connection, or NULL if an internal thread.',
|
338 |
+
`HOST` char(255) DEFAULT NULL -- 'The connection client''s host name, or NULL if an internal thread.',
|
339 |
+
`CURRENT_CONNECTIONS` bigint(20) NOT NULL -- 'Current connections for the account.',\n
|
340 |
+
`TOTAL_CONNECTIONS` bigint(20) NOT NULL -- 'Total connections for the account.'
|
341 |
+
) ;
|
342 |
+
</schema>
|
343 |
+
<question>
|
344 |
+
Tell me the number of active connections each user has.
|
345 |
+
</question>
|
346 |
+
<sql>
|
347 |
+
"""
|
348 |
+
```
|
349 |
+
### response
|
350 |
+
```sql
|
351 |
+
SELECT USER, CURRENT_CONNECTIONS FROM accounts;
|
352 |
+
```
|
353 |
+
|
354 |
+
### prompt
|
355 |
+
```python
|
356 |
+
prompt = """Generate the SQL query for SkySQL performance schema for the following question.
|
357 |
+
<example>
|
358 |
+
--question: What are the top 10 most frequently used queries/statements?
|
359 |
+
--sql: SELECT DIGEST_TEXT, COUNT(*) as frequency FROM performance_schema.events_statements_summary_by_digest GROUP BY DIGEST_TEXT ORDER BY frequency DESC LIMIT 10;
|
360 |
+
</example>
|
361 |
+
<schema>
|
362 |
+
CREATE TABLE `file_summary_by_instance` (
|
363 |
+
`FILE_NAME` varchar(512) NOT NULL -- 'File name.',
|
364 |
+
`EVENT_NAME` varchar(128) NOT NULL -- 'Event name.',
|
365 |
+
`OBJECT_INSTANCE_BEGIN` bigint(20) unsigned NOT NULL -- 'Address in memory. Together with FILE_NAME and EVENT_NAME uniquely identifies a row.',
|
366 |
+
`COUNT_STAR` bigint(20) unsigned NOT NULL -- 'Number of summarized events',
|
367 |
+
`SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL -- 'Total wait time of the summarized events that are timed.',
|
368 |
+
`MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL -- 'Minimum wait time of the summarized events that are timed.',
|
369 |
+
`AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL -- 'Average wait time of the summarized events that are timed.',
|
370 |
+
`MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL -- 'Maximum wait time of the summarized events that are timed.',
|
371 |
+
`COUNT_READ` bigint(20) unsigned NOT NULL -- 'Number of all read operations, including FGETS, FGETC, FREAD, and READ.',
|
372 |
+
`SUM_TIMER_READ` bigint(20) unsigned NOT NULL -- 'Total wait time of all read operations that are timed.',
|
373 |
+
`MIN_TIMER_READ` bigint(20) unsigned NOT NULL -- 'Minimum wait time of all read operations that are timed.',
|
374 |
+
`AVG_TIMER_READ` bigint(20) unsigned NOT NULL -- 'Average wait time of all read operations that are timed.',
|
375 |
+
`MAX_TIMER_READ` bigint(20) unsigned NOT NULL -- 'Maximum wait time of all read operations that are timed.',
|
376 |
+
`SUM_NUMBER_OF_BYTES_READ` bigint(20) NOT NULL -- 'Bytes read by read operations.',
|
377 |
+
`COUNT_WRITE` bigint(20) unsigned NOT NULL -- 'Number of all write operations, including FPUTS, FPUTC, FPRINTF, VFPRINTF, FWRITE, and PWRITE.',
|
378 |
+
`SUM_TIMER_WRITE` bigint(20) unsigned NOT NULL -- 'Total wait time of all write operations that are timed.',
|
379 |
+
`MIN_TIMER_WRITE` bigint(20) unsigned NOT NULL -- 'Minimum wait time of all write operations that are timed.',
|
380 |
+
`AVG_TIMER_WRITE` bigint(20) unsigned NOT NULL -- 'Average wait time of all write operations that are timed.',
|
381 |
+
`MAX_TIMER_WRITE` bigint(20) unsigned NOT NULL -- 'Maximum wait time of all write operations that are timed.',
|
382 |
+
`SUM_NUMBER_OF_BYTES_WRITE` bigint(20) NOT NULL -- 'Bytes written by write operations.',
|
383 |
+
`COUNT_MISC` bigint(20) unsigned NOT NULL -- 'Number of all miscellaneous operations not counted above, including CREATE, DELETE, OPEN, CLOSE, STREAM_OPEN, STREAM_CLOSE, SEEK, TELL, FLUSH, STAT, FSTAT, CHSIZE, RENAME, and SYNC.',
|
384 |
+
`SUM_TIMER_MISC` bigint(20) unsigned NOT NULL -- 'Total wait time of all miscellaneous operations that are timed.',
|
385 |
+
`MIN_TIMER_MISC` bigint(20) unsigned NOT NULL -- 'Minimum wait time of all miscellaneous operations that are timed.',
|
386 |
+
`AVG_TIMER_MISC` bigint(20) unsigned NOT NULL -- 'Average wait time of all miscellaneous operations that are timed.',
|
387 |
+
`MAX_TIMER_MISC` bigint(20) unsigned NOT NULL -- 'Maximum wait time of all miscellaneous operations that are timed.'
|
388 |
+
);
|
389 |
+
</schema>
|
390 |
+
<question>
|
391 |
+
List out 10 names of the files with the most read and writes
|
392 |
+
</question>
|
393 |
+
<sql>
|
394 |
+
"""
|
395 |
+
```
|
396 |
+
|
397 |
+
### response
|
398 |
+
```sql
|
399 |
+
SELECT FILE_NAME FROM file_summary_by_instance ORDER BY SUM_NUMBER_OF_BYTES_READ DESC, SUM_NUMBER_OF_BYTES_WRITE DESC LIMIT 10;
|
400 |
+
```
|
401 |
+
|
402 |
+
|
403 |
+
### 4. Function Calling
|
404 |
+
|
405 |
+
### prompt
|
406 |
+
```python
|
407 |
+
prompt = """
|
408 |
+
Give a function call in python langugae for the following question:
|
409 |
+
<example_response>
|
410 |
+
--doc: Description: This function logs a curl command in debug mode.
|
411 |
+
Parameters:
|
412 |
+
- method (str): The HTTP method to use for the request.
|
413 |
+
- url (str): The URL to send the request to.
|
414 |
+
- data (dict, optional): The data to send in the request. Defaults to None.
|
415 |
+
- headers (dict, optional): The headers to send with the request. Defaults to None.
|
416 |
+
- level (int, optional): The log level to use for this log message. Defaults to logging.DEBUG.
|
417 |
+
Returns:
|
418 |
+
- None
|
419 |
+
Example:
|
420 |
+
log_curl_debug('GET', 'https://example.com')
|
421 |
+
--question: log a curl PUT request for url https://web.io/
|
422 |
+
--function_call: log_curl_debug(method='PUT', url = 'https://web.io')
|
423 |
+
</example_response>
|
424 |
+
<doc>
|
425 |
+
Function Name: make_get_req()
|
426 |
+
Description: This function is used to make a GET request.
|
427 |
+
Parameters:
|
428 |
+
- path (str): The path of the URL to be requested.
|
429 |
+
- data (dict): The data to be sent in the body of the request.
|
430 |
+
- flags (dict): The flags to be sent in the request.
|
431 |
+
- params (dict): The parameters to be sent in the request.
|
432 |
+
- headers (dict): The headers to be sent in the request.
|
433 |
+
- not_json_response (bool): OPTIONAL: If set to True, the function will return the raw response content instead of trying to parse it as JSON.
|
434 |
+
- trailing (str): OPTIONAL: For wrapping slash symbol in the end of string.
|
435 |
+
- absolute (bool): OPTIONAL: If set to True, the function will not prefix the URL with the base URL.
|
436 |
+
- advanced_mode (bool): OPTIONAL: If set to True, the function will return the raw response instead of trying to parse it as JSON.
|
437 |
+
Returns:
|
438 |
+
- Union[str, dict, list, None]: The response content as a string, a dictionary, a list, or None if the response was not successful.
|
439 |
+
</doc>
|
440 |
+
<instruction>
|
441 |
+
1. Strictly use named parameters mentioned in the doc to generate function calls.
|
442 |
+
2. Only return the response as python parsable string version of function call.
|
443 |
+
3. mention the 'self' parameter if required.
|
444 |
+
</instruction>
|
445 |
+
<question>
|
446 |
+
Make a GET request for the URL parameter using variable_2. For the params parameter, use 'weight' as one of the keys with variable_3 as its value, and 'width' as another key with a value of 10. For the data parameter, use variable_1. Prefix the URL with the base URL, and ensure the response is in raw format.
|
447 |
+
</question>
|
448 |
+
<function_call>
|
449 |
+
"""
|
450 |
+
```
|
451 |
+
|
452 |
+
### response
|
453 |
+
```python
|
454 |
+
make_get_req(path='https://example.com/api/v1/users', data=variable_1, params={'weight': variable_3, 'width': 10}, headers={'Content-Type': 'application/json'}, not_json_response=True, absolute=True)
|
455 |
+
```
|
456 |
+
|
457 |
+
### prompt
|
458 |
+
```python
|
459 |
+
prompt = """
|
460 |
+
Give only function call in python langugae as response for the following question:
|
461 |
+
<example_response>
|
462 |
+
--doc:
|
463 |
+
Function:
|
464 |
+
Help on function head in module pandas.core.generic:
|
465 |
+
|
466 |
+
head(self, n: 'int' = 5) -> 'Self'
|
467 |
+
Return the first `n` rows.
|
468 |
+
|
469 |
+
This function returns the first `n` rows for the object based
|
470 |
+
on position. It is useful for quickly testing if your object
|
471 |
+
has the right type of data in it.
|
472 |
+
|
473 |
+
For negative values of `n`, this function returns all rows except
|
474 |
+
the last `|n|` rows, equivalent to ``df[:n]``.
|
475 |
+
|
476 |
+
If n is larger than the number of rows, this function returns all rows.
|
477 |
+
|
478 |
+
Parameters
|
479 |
+
----------
|
480 |
+
n : int, default 5
|
481 |
+
Number of rows to select.
|
482 |
+
|
483 |
+
Returns
|
484 |
+
-------
|
485 |
+
same type as caller
|
486 |
+
The first `n` rows of the caller object.
|
487 |
+
|
488 |
+
See Also
|
489 |
+
--------
|
490 |
+
DataFrame.tail: Returns the last `n` rows.
|
491 |
+
|
492 |
+
Examples
|
493 |
+
--------
|
494 |
+
>>> df = pd.DataFrame({'animal': ['alligator', 'bee', 'falcon', 'lion',
|
495 |
+
... 'monkey', 'parrot', 'shark', 'whale', 'zebra']})
|
496 |
+
>>> df
|
497 |
+
animal
|
498 |
+
0 alligator
|
499 |
+
|
500 |
+
--question: Get the top 5 rows with the highest Engagement_Score. Parameter Description: Use 5 as Number of rows to return ,Use variable_3 as Sorted DataFrame, Do not call any other function, Pass variable to self parameter for method calls
|
501 |
+
--function_call: head(self=variable_3, n=5)
|
502 |
+
</example_response>
|
503 |
+
<doc>
|
504 |
+
Function: sort_values
|
505 |
+
sort_values in module pandas.core.frame:
|
506 |
+
sort_values(self, by: 'IndexLabel', *, axis: 'Axis' = 0, ascending: 'bool | list[bool] | tuple[bool, ...]' = True, inplace: 'bool' = False, kind: 'SortKind' = 'quicksort', na_position: 'str' = 'last', ignore_index: 'bool' = False, key: 'ValueKeyFunc | None' = None) -> 'DataFrame | None'
|
507 |
+
Sort by the values along either axis.
|
508 |
+
Parameters
|
509 |
+
----------
|
510 |
+
by : str or list of str
|
511 |
+
Name or list of names to sort by.
|
512 |
+
|
513 |
+
- if `axis` is 0 or `'index'` then `by` may contain index
|
514 |
+
levels and/or column labels.
|
515 |
+
- if `axis` is 1 or `'columns'` then `by` may contain column
|
516 |
+
levels and/or index labels.
|
517 |
+
axis : "{0 or 'index', 1 or 'columns'}", default 0
|
518 |
+
Axis to be sorted.
|
519 |
+
ascending : bool or list of bool, default True
|
520 |
+
Sort ascending vs. descending. Specify list for multiple sort
|
521 |
+
orders. If this is a list of bools, must match the length of
|
522 |
+
the
|
523 |
+
</doc>
|
524 |
+
<instruction>
|
525 |
+
1. Strictly use named parameters mentioned in the doc to generate function calls.
|
526 |
+
2. Only return the response as python parsable string version of function call.
|
527 |
+
3. Use the 'self' parameter if required in the function call with it's value in named keyword format.
|
528 |
+
</instruction>
|
529 |
+
<question>
|
530 |
+
Using the above function, Sort the DataFrame by the Engagement_Score in descending order. Parameter Description: Use Engagement_Score as Column name to sort by ,Use False as Sort in descending order ,Use variable_1 as DataFrame to sort, Do not call any other function, Pass variable to self parameter for method calls
|
531 |
+
</question>
|
532 |
+
<function_call>
|
533 |
+
"""
|
534 |
+
```
|
535 |
+
### response
|
536 |
+
```python
|
537 |
+
sort_values(self=variable_1, by='Engagement_Score', ascending=False)
|
538 |
+
```
|
539 |
+
|
540 |
+
|
541 |
+
|
542 |
+
### Team
|
543 |
+
Avi Kothari, Gyan Ranjan, Pratham Gupta, Ritvik Aryan Kalra, Soham Acharya
|