semvec/pypi-packages huggingface dataset:
pypreql-nlp 0.0.18
NLP interface for pypreql.

## PreQL NLP

Natural language interface for generating PreQL query objects.

PreQL is easier for a large language model to interact with as it requires only extract relevant concepts from a text,
classifying them as metrics or dimensions, and mapping them to what is available in a model.

This makes it more testable and less prone to hallucination than generating SQL directly. 

Requires setting the following environment variables
- OPENAI_API_KEY
- OPENAI_MODEL

Recommended to use "gpt-3.5-turbo" or higher as the model.

## Examples

### Basic BQ example


```python
from trilogy_public_models import models
from preql import Executor, Dialects
from preql_nlp import build_query

# define the model we want to parse
environment = models["bigquery.stack_overflow"]

# set up preql executor
# default bigquery executor requires local default credentials configured
executor = Dialects.BIGQUERY.default_executor(environment= environment)

# build a query off text and the selected model
processed_query = build_query(
    "How many questions are asked per year?",
    environment,
)

# make sure we got reasonable outputs
for concept in processed_query.output_columns:
    print(concept.name)

# and run that to get our answer
results = executor.execute_query(processed_query)
for row in results:
    print(row)
```

## Don't Expecct Perfection

Results are non-determistic and may not always be accurate.

```sql
# generated from prompt: What is Taylor Swift's birthday? How many questions were asked on that day in 2020?
SELECT
    question.count,
    answer.creation_date.year,
    question.creation_date.year,
    question.creation_date,
WHERE
    question.creation_date.year = 1989
ORDER BY
    question.count desc,

    question.count desc

LIMIT 100;
```



## Setting Up Your Environment

Recommend that you work in a virtual environment with requirements from both requirements.txt and requirements-test.txt installed. The latter is necessary to run
tests (surprise). 

Pypreql-nlp is python 3.10+
pypreqlt 0.0.3
Enhanced PreQL for common ETL needs.

## Simple Declarative Data Pipelines

Combine the simplicity of Preql/Trilogy with the modern data stack. 

Compile your models to ETL scripts to run on demand. Rebuild, run, and test easily.

Translates 'Persist' statements in Preql/Trilogy to scheduled ETL jobs. 

Currently supported backends:
- DBT

> [!WARNING]
> This is a work in progress. Please report any issues or feature requests.


## Flags

--optimize=X - Any CTE used at least X times in calculating final model outputs will be materialized for reuse.


> [!TIP]
> Don't worry about optimizing your temp table graph ever again - write your final tables and let PreqLT handle the rest.


## Install

`pip install pypreqlt`

## How to Run

preqlt <preql_path> <dbt_project_root_path> <backend> --run

```bash
preqlt dbt/models/core/ ./dbt bigquery --run
```

Each source preql file will be built into a separate DBT sub folder with one model per persist statement.

```bash
17:12:37  Running with dbt=1.7.4
17:12:38  Registered adapter: bigquery=1.7.2
17:12:38  Found 4 models, 4 tests, 0 sources, 0 exposures, 0 metrics, 447 macros, 0 groups, 0 semantic models
17:12:38
17:12:40  Concurrency: 4 threads (target='dev')
17:12:40
17:12:41  1 of 4 START sql view model dbt_test.customers ................................. [RUN]
17:12:41  2 of 4 START sql table model dbt_test.customers_preql_preqlt_gen_model ......... [RUN]
17:12:41  3 of 4 START sql table model dbt_test.my_first_dbt_model ....................... [RUN]
17:12:42  1 of 4 OK created sql view model dbt_test.customers ............................ [CREATE VIEW (0 processed) in 1.09s]
17:12:43  3 of 4 OK created sql table model dbt_test.my_first_dbt_model .................. [CREATE TABLE (2.0 rows, 0 processed) in 2.78s]
17:12:43  4 of 4 START sql view model dbt_test.my_second_dbt_model ....................... [RUN]
17:12:44  2 of 4 OK created sql table model dbt_test.customers_preql_preqlt_gen_model .... [CREATE TABLE (100.0 rows, 4.3 KiB processed) in 3.55s]
17:12:44  4 of 4 OK created sql view model dbt_test.my_second_dbt_model .................. [CREATE VIEW (0 processed) in 1.10s]
17:12:44
17:12:44  Finished running 2 view models, 2 table models in 0 hours 0 minutes and 6.37 seconds (6.37s).
17:12:45  
17:12:45  Completed successfully
17:12:45
17:12:45  Done. PASS=4 WARN=0 ERROR=0 SKIP=0 TOTAL=4
customers: success
my_first_dbt_model: success
customers_preql_preqlt_gen_model: success
my_second_dbt_model: success
```


### From IO

```console
Write-Output """constant x <-5; persist into static as static select x;""" | preqlt C:\Users\ethan\coding_projects\pypreql-etl\jaffle_shop bigquery
```
googlevoice 3.1.1
Python Interface for Google Voice
Requires Python: >=3.8

.. image:: https://img.shields.io/pypi/v/googlevoice.svg
   :target: https://pypi.org/project/googlevoice

.. image:: https://img.shields.io/pypi/pyversions/googlevoice.svg

.. image:: https://github.com/jaraco/googlevoice/actions/workflows/main.yml/badge.svg
   :target: https://github.com/jaraco/googlevoice/actions?query=workflow%3A%22tests%22
   :alt: tests

.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
    :target: https://github.com/astral-sh/ruff
    :alt: Ruff

.. image:: https://readthedocs.org/projects/googlevoice/badge/?version=latest
   :target: https://googlevoice.readthedocs.io/en/latest/?badge=latest

.. image:: https://img.shields.io/badge/skeleton-2024-informational
   :target: https://blog.jaraco.com/skeleton


Python Google Voice Library

Based on pygooglevoice by Joe McCall & Justin Quick.

This project is *essentially broken* as the login API has changed and a new technique for logging in has not been developed. Please see `issue 8 <https://github.com/jaraco/googlevoice/issues/8>`_ for details.


Exposing the Google Voice "API" to the Python language
-------------------------------------------------------

Google Voice for Python Allows you to place calls, send sms, download voicemail, and check the various folders of your Google Voice Account.
You can use the Python API or command line script to schedule calls, check for new recieved calls/sms, or even sync your recorded voicemails/calls.
llm-performance-benchmark 1.0.1
Benchmark the performance (output speed, latency) of OpenAI compatible endpoints
Requires Python: >=3.7.1


# LLM Performance Benchmark

> Benchmark the performance of OpenAI compatible APIs in terms of Time to First Token (commonly referred to as latency) and Output Tokens per Second.

## Background
Benchmarking script used by [Artificial Analysis](https://artificialanalysis.ai/) for our performance benchmarks.

For performance benchmarks across >150 endpoints, including across varied prompt lengths & parallel queries, visit: [Artificial Analysis API Provider Peformance Leaderboard](https://artificialanalysis.ai/leaderboards/providers)

## Install
```bash
# Install from PyPI
pip install llm_performance_benchmark
```

## Usage
```python
from llm_performance_benchmark import llm_performance_benchmark

# Configure endpoint
import os
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv("OPENAI_API_KEY")
base_url = "https://api.openai.com/v1"
model_id = "gpt-4-turbo"

# Configure prompt
user_prompt = "What is the purpose of life?"
system_prompt = "You are a helpful assistant."

# Run benchmark
result = llm_performance_benchmark(model_id=model_id, 
                                   user_prompt=user_prompt, 
                                   system_prompt=system_prompt, 
                                   api_key=api_key, 
                                   base_url=base_url,
                                   print_response=True)
print(result)
""" Example response:
{
    'total_time': 8.9, 
    'time_to_first_token': 0.6, 
    'output_tokens_per_second': 39.4, 
    'tokens_per_second_across_total_request': 36.4,
    'response_text: "..."
}
"""
```

## Definitions of output metrics
For definitions of what the metrics represent, see the following [https://artificialanalysis.ai/methodology](https://artificialanalysis.ai/methodology) page.
To standardize token counting across different models, text is tokenized as cl100k_base tokens (used by GPT-4) with Tiktoken. 

## License
#### MIT License
Copyright (c) 2024 Artificial Analysis, Inc.

See LICENSE file for further details