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

|
| 47 |
|
| 48 |
+
Given a goal and tools can Ai intelligently use the tools to reach the goal ?
|
| 49 |
+
What if it has a meagre 1.3b params/neurons akin to that of an owl ? Can it follow instructions and plan to reach a goal ?
|
| 50 |
+
Apparently it can.
|
| 51 |
+
Releasing `pip-code-bandit` and `pip_flow` a model and a library to manage and run goal oriented agentic system.
|
| 52 |
|
|
|
|
| 53 |
|
| 54 |
+
## Model attributes
|
| 55 |
|
| 56 |
+
```javascript
|
| 57 |
+
-- number of params ~ 1.3b [2.9 Gb GPU memory footprint]
|
| 58 |
+
-- sequence length ~ 16.3k [Can go higher but will show performance degradation]
|
| 59 |
+
-- license - apache 2.0
|
| 60 |
+
-- tasks:
|
| 61 |
+
1. complex planning of sequential function calls with right params to accomplish a goal | a list of callables
|
| 62 |
+
2. function calling | doc or code and goal
|
| 63 |
+
3. code generation | plan and goal
|
| 64 |
+
4. code generation | goal
|
| 65 |
+
5. doc generation | code
|
| 66 |
+
6. code generation | doc
|
| 67 |
+
7. file recreated in json | any raw data
|
| 68 |
+
8. corrected generation | new instruction with error
|
| 69 |
+
-- instruction following , RL tuned.
|
| 70 |
+
```
|
| 71 |
|
|
|
|
| 72 |
|
| 73 |
+
## How we built it?
|
| 74 |
|
| 75 |
+
We used a simulator to simulate environments where the model could play games to achieve goals, given a set of actions available to it.
|
| 76 |
+
All the model could do was find the right action and config to incur positive reward.
|
| 77 |
+
The reward policy is around the concept of model going to a stable state of zero net sum reward for both good and bad behaviour.
|
| 78 |
+
In this set up the model, which was pre trained on code , function documentation and similar OS datasets ,was RL tuned for instruction following and reliability.
|
| 79 |
|
| 80 |
+
## License
|
|
|
|
| 81 |
|
| 82 |
+
The model is open source under apache 2.0. License
|
|
|
|
| 83 |
|
| 84 |
+
## Usage
|
| 85 |
|
| 86 |
+
### NOTE:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
|
|
|
| 89 |
|
| 90 |
### Library use
|
| 91 |
|
| 92 |
+
For directly using the capabilities of model without putting extra efforts on schems and prompts try to use [pip flow]().
|
| 93 |
|
| 94 |
Here's a brief overview of what can be achieved using the PipEtl library:
|
| 95 |
|
|
|
|
| 98 |
- `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.
|
| 99 |
- `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.
|
| 100 |
|
| 101 |
+
For detailed usage refer to the [colab_notebook](https://colab.research.google.com/drive/10av3SxFf0Psx_IkmZbcUhiVznStV5pVS?usp=sharing)
|
| 102 |
+
|
| 103 |
|
| 104 |
|
| 105 |
### Installation
|
|
|
|
| 109 |
```
|
| 110 |
|
| 111 |
### Prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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