semvec/pypi-packages huggingface dataset:
autofns 0.1.7
AutoFNS is a utility for automatically calling functions when interacting with the OpenAI Completions.
License: MIT
Requires Python: >=3.10,<4.0
Keywords: ai,openai,gpt-3,gpt-4,functions,chat completions,utility,autofns

# AutoFNS

## Introduction

AutoFNS is a wrapper around OpenAI's Chat Completion API. 

It allows you to define functions as you normally would, and have them be called
automatically when a message containing tool calls is detected. This allows you to focus on
more important things, like the logic of your application.

Note: 🧪 This is a work in progress and may not be ready for production use.

## Requirements

- python >= 3.10
- openai

## Installation

```bash
pip install autofns
```

## Usage

```python
from autofns import AutoFNS

FUNCTION_DEFINITIONS = [
    {
        "type": "function",
        "function": {
            "name": "get_temp_units",
            "description": "Get a list of temperature units",
        }
    },
    {
        "type": "function",
        "function": {
            "name": "get_current_temperature",
            "description": "Get the current temperature in a city",
        },
        "parameters": {
            "type": "object",
            "properties": {
                "city": {
                    "type": "string",
                    "description": "The city to get the temperature of",
                },
                "unit": {
                    "type": "string",
                    "description": "The unit to get the temperature in",
                    "enum": ["Fahrenheit", "Celsius", "Kelvin"],
                }
            },
            "required": ["city", "unit"],
        }
    },
]


def get_temp_units():
    return ["Fahrenheit", "Celsius", "Kelvin"]


def get_current_temperature(city: str, unit: str):
    return "The current temperature in {} is {} degrees {}".format(
        city, 72, unit
    )


fns = AutoFNS(
    "gpt-4-32k",
    fns_mapping={
        "get_temp_units": get_temp_units,
        "get_current_temperature": get_current_temperature
    },
    fns_definitions=FUNCTION_DEFINITIONS,
)

result = fns.create_completion(messages=[...])
```


You can also use the `AutoFNSAsync` class to use async functions:

```python
from autofns import AutoFNSAsync

fns = AutoFNSAsync(...)

result = await fns.create_completion(messages=[...])
```

## License
This project is licensed under the terms of the MIT license.

## Contributing
Contributions are welcome! Please open an issue or a pull request.
geojsonfix 0.0.2
Validates and fixes GeoJSON
License: MIT
Requires Python: >=3.8

<img src="./header_img.jpeg">

**Validates and automatically fixes invalid GeoJSON - 🌎 Webapp and 🐍 Python package.** 

The only tool that addresses all potential issues:
- **Invalid** according to GeoJSON specification: e.g. duplicate nodes, wrong winding order, unclosed 
- **Problematic** with some tools & APIs: e.g. self-intersection, holes, crossing anti-meridian


<h3 align="center">
    🎈 <a href="https://geojsonfix.streamlit.app/">Try it out here: geojsonfix webapp 🎈 </a>
</h3>

<br>

## Python package

### Installation
```bash
pip install geojsonfix
```

### Usage

As input takes any GeoJSON (dictionary, filepath, url), shapely geometry or anything with a __geo_interface__.

```python
import geojsonfix

geojson = {'type': 'FeatureCollection',
           'features': [{'type': 'Feature', 'geometry':
             {'type': 'Polygon', 'coordinates': [[[-59.758285, 8.367035], ...]]}}]}

geojsonfix.validate(geojson)
```
The result gives the reason and positional index of the invalid geometry.
```json
{"invalid": {"duplicate_nodes": [2]},
 "problematic": {"self_intersection": [0, 2], "crosses_antimeridian": [1]},
 "count_geometry_types": {"Polygon": 2, "MultiPolygon": 1}}
```

<br>

### Parameters
It is possible to select only specific validation criteria. For comprehensive criteria descriptions,
see the [geojson-invalid-geometry](https://github.com/chrieke/geojson-invalid-geometry) list.

```python
# Invalid according to the GeoJSON specification
criteria_invalid = ["unclosed", "duplicate_nodes", "less_three_unique_nodes", "exterior_not_ccw", 
                    "interior_not_cw", "inner_and_exterior_ring_intersect", "crs_defined", 
                    "outside_lat_lon_boundaries"]

# Problematic with some tools & APIs
criteria_problematic = ["holes", "self_intersection", "excessive_coordinate_precision", 
                        "more_than_2d_coordinates", "crosses_antimeridian"]

geojsonfix.validate(geojson, criteria_invalid, criteria_problematic)
```

<br>
<br>

## TODO:
- Automatically fix geometries
- Accept all Geometry types, validate/fix depending on type
- Check for incorrect geometry data type in type vs. geometry pattern
- bbox order and other criteria
- Multihtreading?

No:
- Filsupport wkt etc. that would require more dependencies.