semvec/pypi-packages huggingface dataset:
bedrock-syntaxer 0.2.0
A utility to force AWS Bedrock to apply the given syntax to its response.
Requires Python: >=3.9

# Bedrock Syntaxer

A utility to force AWS Bedrock to apply the given syntax to its response.

## Installation

To install the required dependencies, run:

```bash
pip install -r requirements.txt
```

## Usage

### Function: `bedrock_syntaxer`

A utility to force Bedrock to apply the given syntax to its response.

#### Parameters:

- `model_id` (str): The model ID of the Bedrock model.
- `messages` (list): The messages to send to Bedrock.
- `syntax` (str): The syntax to apply to the response.
- `inference_config` (dict, optional): The inference configuration to use.
- `region_name` (str, optional): The region name of the Bedrock model.

#### Returns:

- `str`: The response from Bedrock with the syntax applied.

### Example

```python
from bedrock_syntaxer import bedrock_syntaxer
import json

ACCOUNT_ID = "961341532715"
REGION = "us-east-1"
MODEL_NAME = "claude-3-5-sonnet-20241022-v2:0"
MODEL_ID = f"arn:aws:bedrock:{REGION}:{ACCOUNT_ID}:inference-profile/us.anthropic.{MODEL_NAME}"

prompt = (
    "Write the definition of 3 Filipino word in JSON format. "
    "The words are 'kamusta', 'salamat', and 'paalam'."
    "Use the keys 'word' and 'definition'."
)
messages = [{"role": "user", "content": [{"text": prompt}]}]

response = bedrock_syntaxer(
    model_id=MODEL_ID,
    messages=messages,
    syntax="json",
    region_name=REGION,
)

print(response)

# The response is a JSON string.
response_json = json.loads(response)
```

## Testing

To run the tests, use:

```bash
pytest
```
lartillot-gaussian 0.0.2
A simple multi-dimensional Gaussian model from Lartillot et al '06, useful for testing Bayesian applications.
Requires Python: >=3.8

# Lartillot Gaussian model

![PyPI](https://img.shields.io/pypi/v/lartillot_gaussian)


The multidimensional Gaussian model from [Lartillot et al '06] is useful for testing Bayesian applications.

The model is parameterised by a vector $\theta = (\theta_1, \theta_2, \ldots, \theta_d)$ of dimension $d$. 
The prior on $\theta$ is a product of independent normals with a null mean and unit variance. 
The likelihood function is given by 
$$\mathcal{L}(\theta, v) =  {(2\pi v)^{-d/2}} \prod_{i = 1}^d \text{exp}\bigg[\frac{-\theta_i^2}{2v}\bigg],$$
where $v$ is the common variance for all $d$ dimensions. 

The joint posterior is given by $d$ products of $\mathcal{N}(0, v/(1+v))$. Finally, the evidence is given by
$$    \mathcal{Z} = (2\pi v)^{-d/2} \left(\frac{v}{1 + v} \right)^{d/2}=\left(2\pi(1+v)\right)^{-d/2}\ . $$


[Lartillot et al '06]: https://academic.oup.com/sysbio/article-abstract/55/2/195/1620800?redirectedFrom=fulltext


This codebase provides a simple implementation of the Lartillot Gaussian model in Python.

```bash
pip install lartillot_gaussian
```


```python

from lartillot_gaussian import LartillotGaussianModel
import numpy as np

model = LartillotGaussianModel(d=10, v=1.0)
theta = np.array([[0]])
print(model.lnz)

```