semvec/pypi-packages huggingface dataset:
jaxglm 0.1.1
Add your description here
Requires Python: >=3.12

# Jax GLM

Bayesian Generalized Linear Models with a statsmodels-like API built on NumPyro.

## Features

- Standard GLM families (Gaussian, Binomial, Poisson, Gamma, etc.)
- Ordinal logistic regression
- Flexible link functions
- Patsy formula interface
- ArviZ integration for diagnostics
- Full posterior inference with NUTS

## Installation
httptools 0.7.1
A collection of framework independent HTTP protocol utils.
Requires Python: >=3.9

![Tests](https://github.com/MagicStack/httptools/workflows/Tests/badge.svg)

httptools is a Python binding for the nodejs HTTP parser.

The package is available on PyPI: `pip install httptools`.


# APIs

httptools contains two classes `httptools.HttpRequestParser`,
`httptools.HttpResponseParser` (fulfilled through
[llhttp](https://github.com/nodejs/llhttp)) and a function for
parsing URLs `httptools.parse_url` (through
[http-parse](https://github.com/nodejs/http-parser) for now).
See unittests for examples.


```python

class HttpRequestParser:

    def __init__(self, protocol):
        """HttpRequestParser

        protocol -- a Python object with the following methods
        (all optional):

          - on_message_begin()
          - on_url(url: bytes)
          - on_header(name: bytes, value: bytes)
          - on_headers_complete()
          - on_body(body: bytes)
          - on_message_complete()
          - on_chunk_header()
          - on_chunk_complete()
          - on_status(status: bytes)
        """

    def get_http_version(self) -> str:
        """Return an HTTP protocol version."""

    def should_keep_alive(self) -> bool:
        """Return ``True`` if keep-alive mode is preferred."""

    def should_upgrade(self) -> bool:
        """Return ``True`` if the parsed request is a valid Upgrade request.
	The method exposes a flag set just before on_headers_complete.
	Calling this method earlier will only yield `False`.
	"""

    def feed_data(self, data: bytes):
        """Feed data to the parser.

        Will eventually trigger callbacks on the ``protocol``
        object.

        On HTTP upgrade, this method will raise an
        ``HttpParserUpgrade`` exception, with its sole argument
        set to the offset of the non-HTTP data in ``data``.
        """

    def get_method(self) -> bytes:
        """Return HTTP request method (GET, HEAD, etc)"""


class HttpResponseParser:

    """Has all methods except ``get_method()`` that
    HttpRequestParser has."""

    def get_status_code(self) -> int:
        """Return the status code of the HTTP response"""


def parse_url(url: bytes):
    """Parse URL strings into a structured Python object.

    Returns an instance of ``httptools.URL`` class with the
    following attributes:

      - schema: bytes
      - host: bytes
      - port: int
      - path: bytes
      - query: bytes
      - fragment: bytes
      - userinfo: bytes
    """
```


# Development

1. Clone this repository with
   `git clone --recursive git@github.com:MagicStack/httptools.git`

2. Create a virtual environment with Python 3:
   `python3 -m venv envname`

3. Activate the environment with `source envname/bin/activate`

4. Run `make` and `make test`.


# License

MIT.
openinference-instrumentation-groq 0.1.12
OpenInference Groq Instrumentation
Requires Python: <3.15,>=3.9

# OpenInference Groq Instrumentation

Python autoinstrumentation library for the [Groq](https://wow.groq.com/why-groq/) package

This package implements OpenInference tracing for both Groq and AsyncGroq clients.

These traces are fully OpenTelemetry compatible and can be sent to an OpenTelemetry collector for viewing, such as [Arize `phoenix`](https://github.com/Arize-ai/phoenix).


## Installation

```shell
pip install openinference-instrumentation-groq
```

## Quickstart

Through your *terminal*, install required packages.

```shell
pip install openinference-instrumentation-groq groq arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp
```

You can start Phoenix with the following terminal command:
```shell
python -m phoenix.server.main serve
````
By default, Phoenix listens on `http://localhost:6006`. You can visit the app via a browser at the same address. (Phoenix does not send data over the internet. It only operates locally on your machine.)


Try the following code in a *Python file*.

1. Set up `GroqInstrumentor` to trace your application and sends the traces to Phoenix. 
2. Then, set your Groq API key as an environment variable. 
3. Lastly, create a Groq client, make a request, then go see your results in Phoenix at `http://localhost:6006`!

```python
import os
from groq import Groq
from openinference.instrumentation.groq import GroqInstrumentor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk import trace as trace_sdk
from opentelemetry.sdk.trace.export import SimpleSpanProcessor

# Configure GroqInstrumentor with Phoenix endpoint
endpoint = "http://127.0.0.1:6006/v1/traces"
tracer_provider = trace_sdk.TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))

GroqInstrumentor().instrument(tracer_provider=tracer_provider)

os.environ["GROQ_API_KEY"] = "YOUR_KEY_HERE"

client = Groq()

chat_completion = client.chat.completions.create(
    messages=[
        {
            "role": "user",
            "content": "Explain the importance of low latency LLMs",
        }
    ],
    model="llama3-8b-8192",
)

if __name__ == "__main__":
    print(chat_completion.choices[0].message.content)
```

Now, on the Phoenix UI on your browser, you should see the traces from your Groq application. Click on a trace, then the "Attributes" tab will provide you with in-depth information regarding execution!

## More Info

* [More info on OpenInference and Phoenix](https://docs.arize.com/phoenix)
* [How to customize spans to track sessions, metadata, etc.](https://github.com/Arize-ai/openinference/tree/main/python/openinference-instrumentation#customizing-spans)
* [How to account for private information and span payload customization](https://github.com/Arize-ai/openinference/tree/main/python/openinference-instrumentation#tracing-configuration)
openinference-instrumentation-guardrails 0.1.10
OpenInference Guardrails Instrumentation
Requires Python: <3.15,>=3.9

# OpenInference guardrails Instrumentation

[![pypi](https://badge.fury.io/py/openinference-instrumentation-guardrails.svg)](https://pypi.org/project/openinference-instrumentation-guardrails/)

Python auto-instrumentation library for LLM applications implemented with Guardrails

Guards are fully OpenTelemetry-compatible and can be sent to an OpenTelemetry collector for monitoring, such as [`arize-phoenix`](https://github.com/Arize-ai/phoenix).

## Installation

```shell
pip install openinference-instrumentation-guardrails
```

## Quickstart

This quickstart shows you how to instrument your guardrailed LLM application 

Install required packages.

```shell
pip install openinference-instrumentation-guardrails guardrails-ai arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp
```

Start Phoenix in the background as a collector. By default, it listens on `http://localhost:6006`. You can visit the app via a browser at the same address. (Phoenix does not send data over the internet. It only operates locally on your machine.)

```shell
python -m phoenix.server.main serve
```

Install the TwoWords validator that's used in the Guard.

```shell
guardrails hub install hub://guardrails/two_words
```

Set up `GuardrailsInstrumentor` to trace your guardrails application and sends the traces to Phoenix at the endpoint defined below.
```python
from openinference.instrumentation.guardrails import GuardrailsInstrumentor
from opentelemetry import trace as trace_api
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk import trace as trace_sdk
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
import os

os.environ["OPENAI_API_KEY"] = "YOUR_KEY_HERE"

endpoint = "http://127.0.0.1:6006/v1/traces"
tracer_provider = trace_sdk.TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))
trace_api.set_tracer_provider(tracer_provider)

GuardrailsInstrumentor().instrument()
```

Set up a simple example of LLM call using a Guard
```python
from guardrails import Guard
from guardrails.hub import TwoWords
import openai

guard = Guard().use(
    TwoWords(),
)

response = guard(
    llm_api=openai.chat.completions.create,
    prompt="What is another name for America?",
    model="gpt-3.5-turbo",
    max_tokens=1024,
)

print(response)
```

## More Info

* [More info on OpenInference and Phoenix](https://docs.arize.com/phoenix)
* [How to customize spans to track sessions, metadata, etc.](https://github.com/Arize-ai/openinference/tree/main/python/openinference-instrumentation#customizing-spans)
* [How to account for private information and span payload customization](https://github.com/Arize-ai/openinference/tree/main/python/openinference-instrumentation#tracing-configuration)
openinference-instrumentation-anthropic 0.1.20
OpenInference Anthropic Instrumentation
Requires Python: <3.15,>=3.9

# OpenInference Anthropic Instrumentation

Python autoinstrumentation library for the [Anthropic](https://www.anthropic.com/api) package

This package implements the following Anthropic clients:
- `Messages`
- `Completions`
- `AsyncMessages`
- `AsyncCompletions`

These traces are fully OpenTelemetry compatible and can be sent to an OpenTelemetry collector for viewing, such as [Arize `phoenix`](https://github.com/Arize-ai/phoenix).


## Installation

```shell
pip install openinference-instrumentation-anthropic
```

## Quickstart

Through your *terminal*, install required packages.

```shell
pip install openinference-instrumentation-anthropic anthropic arize-phoenix opentelemetry-sdk opentelemetry-exporter-otlp
```

You can start Phoenix with the following terminal command:
```shell
python -m phoenix.server.main serve
````
By default, Phoenix listens on `http://localhost:6006`. You can visit the app via a browser at the same address. (Phoenix does not send data over the internet. It only operates locally on your machine.)


Try the following code in a *Python file*.

1. Set up `AnthropicInstrumentor` to trace your application and sends the traces to Phoenix. 
2. Then, set your Anthropic API key as an environment variable. 
3. Lastly, create a Anthropic client, make a request, then go see your results in Phoenix at `http://localhost:6006`!

```python
import os
from anthropic import Anthropic
from openinference.instrumentation.anthropic import AnthropicInstrumentor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.sdk import trace as trace_sdk
from opentelemetry.sdk.trace.export import SimpleSpanProcessor

# Configure AnthropicInstrumentor with Phoenix endpoint
endpoint = "http://127.0.0.1:6006/v1/traces"
tracer_provider = trace_sdk.TracerProvider()
tracer_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter(endpoint)))

AnthropicInstrumentor().instrument(tracer_provider=tracer_provider)

os.environ["ANTHROPIC_API_KEY"] = "YOUR_KEY_HERE"

client = Anthropic()

response = client.messages.create(
    max_tokens=1024,
    messages=[
        {
            "role": "user",
            "content": "Tell me about the history of Iceland!",
        }
    ],
    model="claude-3-opus-20240229",
)
print(response)
```

Now, on the Phoenix UI on your browser, you should see the traces from your Anthropic application. Click on a trace, then the "Attributes" tab will provide you with in-depth information regarding execution!