semvec/pypi-packages huggingface dataset:
pgbouncer 0.1.0
Fixture to bring up temporary pgbouncer instance.
Requires Python: >=3.5

************************************************
python-pgbouncer: Python glue to drive pgbouncer
************************************************

    Copyright (c) 2011, Canonical Ltd

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
python-pgbouncer provides a python interface to setup and run a pgbouncer
instance.

Dependencies
============

* Python 3.5+

* pgbouncer

* psycopg2 (https://pypi.org/project/psycopg2)

* python-fixtures (https://launchpad.net/python-fixtures or
  https://pypi.org/project/fixtures)

* testtools (https://pypi.org/project/testtools)

Testing Dependencies
====================

In addition to the above, the tests also depend on:

* postgresfixture (https://pypi.org/project/postgresfixture)

* testscenarios (https://pypi.org/project/testscenarios)

Usage
=====

Create a PGBouncerFixture - a context manager with an extended protocol
supporting access to logs etc. Customise it with database definitions, user
credentials, and then when you enter the context it will create a transient
pgbouncer setup in a temporary directory and run it for the duration that the
context is open.

For instance::

 >>> from pgbouncer import PGBouncerFixture
 >>> bouncer = PGBouncerFixture()
 >>> bouncer.databases['mydb'] = 'host=hostname dbname=foo'
 >>> bouncer.users['user1'] = 'credentials'
 >>> with bouncer:
 ...     # Can now connect to bouncer.host port=bouncer.port user=user1

Any settings required for pgbouncer to work will be given sane defaults.


Installation
============

Either run setup.py in an environment with all the dependencies available, or
add the working directory to your PYTHONPATH.


Development
===========

Upstream development takes place at https://launchpad.net/python-pgbouncer.

To run the tests, run:

 $ tox
arianna-first-package 0.2.0
Arianna's first package is a simple Python package for learning puropses.
Requires Python: <4.0,>=3.10

# Arianna's first package


[![PyPI Status](https://img.shields.io/pypi/v/arianna-first-package.svg)](https://pypi.python.org/pypi/arianna-first-package)
[![Build Status](https://github.com/AriannaBonazza/arianna-first-package/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/AriannaBonazza/arianna-first-package/actions?query=workflow%3Abuild)
[![Documentation Status](https://github.com/AriannaBonazza/arianna-first-package/actions/workflows/docs.yml/badge.svg?branch=main)](https://github.com/AriannaBonazza/arianna-first-package/actions?query=workflow%3Adocs)
[![License](https://img.shields.io/github/license/AriannaBonazza/arianna-first-package)](https://github.com/AriannaBonazza/arianna-first-package/blob/main/LICENSE)
[![Code Coverage](https://codecov.io/gh/AriannaBonazza/arianna-first-package/branch/main/graphs/badge.svg)](https://codecov.io/gh/AriannaBonazza/arianna-first-package/tree/main)

Arianna's first package is a simple Python package for learning puropses.


- Free software: MIT license
- Documentation: https://AriannaBonazza.github.io/arianna-first-package/.


## Features

- TODO

## Credits

This package was created with [Cookiecutter][CC] and the [Package Helper 3][PH3] project template during my stage at Swapcard.

[CC]: https://github.com/audreyr/cookiecutter
[PH3]: https://balouf.github.io/package-helper-3/
hostasphere-profiler 1.0
Hostasphere Profiler API
Requires Python: >=3.6

# ![hostasphere](https://avatars.githubusercontent.com/u/164780978?s=30 "logo") hand-e.fr

## Hostasphere - Profiler API

### Description

The Profiling API allows you to measure execution time, memory usage,
and other metrics related to OpenHosta for Python functions.
The collected data is sent to your Hostasphere monitoring interface.

### Installation

Install the required dependencies with pip :

```schell
pip install hostasphere-profiler==v1.0
```

### Usage

To profile a function, use the decorator `@profiler.track()`:

```python
from profiler.core import Profiler

profiler = Profiler(
    address='localhost:50051', # required, is the address of the datasource, default is 'localhost:50051'
    token='hsp_0d6d562910026e3ba0b511dd2c99a47d374f810055003c149eb5fbcdad693319', # required
    refresh_interval=0.1, # optional, double representing the interval in seconds between each refresh of recorded metrics, default is 0.1
    session_tag="dev-1", # optional, string representing the session tag, default is None, esaier to identify the session in the monitoring interface
)

@profiler.track()
def my_func():
    # Function logic
    pass
```

#### Add markers
Yo can add markers to your profiling session to help you identify specific parts of your code.
```python
profiler.get_session().add_annotation('Calculating CPU usage', '#008000')
```
annotation: str
color: str # optional, default is '#000000'

You can find many examples in the [examples](https://github.com/hand-e-fr/hostasphere/tree/main/api/python3/examples) folder.

### In future versions

- Catch exceptions and send them to the monitoring interface
- Add more metrics
- Add the possibility to send custom metrics
- Add the possibility to send logs
- Add the possibility to send traces
ally-ai-langchain 0.5.0
langchain-openai package for ally
Requires Python: >=3.8

# Ally AI

## How to use

### Config File

```yaml
llm:
  api_key: '<private-key>'
  api_version: "<api-version>"
  endpoint: "<endpoint>"
  model: "<model-name>"
  deployment_name: '<deployment-name>'
  temperature: 0.7
  streaming: true

embeddings:
  api_key: '<private-key>'
  api_version: "<api-version>"
  endpoint: "<endpoint>"
  model: "<model-name>"
  deployment_name: '<deployment-name>'
```

### Create LLM

#### Use Default Settings in LLM

```python
from ally_ai_langchain import LLM

llm = LLM()
response = llm.invoke('What is an ally?')
print(response)
```

#### Use Custom Settings in LLM

```yaml
my_llm:
  api_key: '<private-key>'
  api_version: "<api-version>"
```

```python
from ally_ai_langchain import LLM, Settings

settings = Settings(section='my_llm')
llm = LLM(settings=settings)
print(llm.settings.path)
print(llm.settings.section)
```

#### Override Settings in LLM

```python
from ally_ai_langchain import LLM, Settings

settings = Settings(section='my_llm', api_key='<new-api-key>')
llm = LLM(settings=settings)
response = llm.invoke('What is an ally?')
print(response)
```


### How to Create Embeddings

```python
from ally_ai_langchain import EmbeddingModel

model = EmbeddingModel()
response = model.embed_query('What is an ally?')
print(response)
```
ally-ai-chroma 0.5.0
langchain chroma package for ally
Requires Python: >=3.8

# Ally AI Chroma

## How to use

### Config File

#### Use API

```yaml
chromadb:
  host: "<endpoint>"
  port: 8000
  ssl: False
```

#### Use Local
```yaml
chromadb:
  persist_directory: './chroma/chroma'
```


### Initialize

```python
from ally_ai_chroma import Chroma

chroma = Chroma()
```
policy-validator 0.1.0
A policy validation tool using OpenAI Models
Requires Python: >=3.8
Keywords: openai, GPT, policy validation, content moderation


# Policy Validator

Policy Validator is a Python package that leverages OpenAI's GPT models to validate text against predefined content policies. It ensures that user input conforms to specific rules, making it useful for content moderation, compliance checks, and safety regulations.

## Key Features
- **OpenAI GPT Integration**: Uses OpenAI models to validate text based on content moderation policies.
- **Retry Mechanism**: Ensures reliable API calls with built-in retry functionality.
- **Logging**: Offers comprehensive logging to track and debug policy validation processes.
- **Flexible Policy Input**: Policies can be supplied either as tuples directly or loaded from a file.
- **Customizable**: Adjust model parameters such as max tokens, temperature, and the specific OpenAI's model used.

## Installation

To install the Policy Validator package, use `pip`:

```bash
pip install policy_validator
```

## Usage

The `PolicyValidator` class allows you to pass policies either as a tuple or via a file.

### Example 1: Passing Policies as a Tuple

In this example, policies are defined directly as a tuple in Python:

```python
from policy_validator import PolicyValidator

# Define policies directly as a tuple
policies = (
    "No abusive language.",
    "No personal information sharing.",
    "No inappropriate content."
)

api_key = "your_openai_api_key"
validator = PolicyValidator(api_key=api_key, model="gpt-4o-mini", max_tokens=100, temperature=0.3, policies=policies)

# Validate user input
result = validator.validate("Who is John Doe?")
print(result)
```

### Example 2: Passing Policies via a File

You can also load policies from a file. First, create a `policies.txt` file with the following content:

```plaintext
Policy 1: No abusive language.
Policy 2: No personal information sharing.
Policy 3: No inappropriate content.
```

Now load the policies from this file:

```python
from policy_validator import PolicyValidator

api_key = "your_openai_api_key"
validator = PolicyValidator(api_key=api_key, model="gpt-4o-mini", max_tokens=100, temperature=0.3, policies_file="policies.txt")

# Validate user input
result = validator.validate("Who is Ashkan Rafiee?")
print(result)
```

## Important: Securely Managing API Keys

It's recommended to **avoid hardcoding your API key** in your code as shown in the above examples. Instead, use a more secure method, such as:

- **Environment variables**: Store the API key in an environment variable and access it via `os.getenv()`.
  
  ```python
  import os
  api_key = os.getenv("OPENAI_API_KEY")
  ```

- **Secret management systems**: Use secure secret management tools such as AWS Secrets Manager, Azure Key Vault, or HashiCorp Vault to securely store and access the API key in a managed way.


For any issues, feel free to submit a bug report or open a discussion.

## License

This project is licensed under the MIT License. See the `LICENSE` file for details.