semvec/pypi-packages huggingface dataset:
dify-oapi 0.0.15
A package for interacting with the Dify Service-API
License: MIT
Requires Python: <4.0,>=3.10
Keywords: dify, nlp, ai, language-processing

# dify-oapi

A Dify App Service-API Client, using for build a webapp by request Service-API

## Usage

First, install `dify-oapi` python sdk package:

```
pip install dify-oapi
```

Write your code with sdk:

- chat generate with `blocking` response_mode

```python
from dify_oapi.api.chat.v1.model.chat_request import ChatRequest
from dify_oapi.api.chat.v1.model.chat_request_body import ChatRequestBody
from dify_oapi.api.chat.v1.model.chat_request_file import ChatRequestFile
from dify_oapi.client import Client
from dify_oapi.core.model.request_option import RequestOption

def main():
    client = Client.builder().domain("https://api.dify.ai").build()
    req_file = (
        ChatRequestFile.builder()
        .type("image")
        .transfer_method("remote_url")
        .url("https://cloud.dify.ai/logo/logo-site.png")
        .build()
    )
    req_body = (
        ChatRequestBody.builder()
        .inputs({})
        .query("What are the specs of the iPhone 13 Pro Max?")
        .response_mode("blocking")
        .conversation_id("")
        .user("abc-123")
        .files([req_file])
        .build()
    )
    req = ChatRequest.builder().request_body(req_body).build()
    req_option = RequestOption.builder().api_key("<your-api-key>").build()
    response = client.chat.v1.chat.chat(req, req_option, False)
    # response = await client.chat.v1.chat.achat(req, req_option, False)
    print(response.success)
    print(response.code)
    print(response.msg)
    print(response.answer)


if __name__ == "__main__":
    main()

```

- chat generate with `streaming` response_mode

```python
from dify_oapi.api.chat.v1.model.chat_request import ChatRequest
from dify_oapi.api.chat.v1.model.chat_request_body import ChatRequestBody
from dify_oapi.api.chat.v1.model.chat_request_file import ChatRequestFile
from dify_oapi.client import Client
from dify_oapi.core.model.request_option import RequestOption

def main():
    client = Client.builder().domain("https://api.dify.ai").build()
    req_file = (
        ChatRequestFile.builder()
        .type("image")
        .transfer_method("remote_url")
        .url("https://cloud.dify.ai/logo/logo-site.png")
        .build()
    )
    req_body = (
        ChatRequestBody.builder()
        .inputs({})
        .query("What are the specs of the iPhone 13 Pro Max?")
        .response_mode("streaming")
        .conversation_id("")
        .user("abc-123")
        .files([req_file])
        .build()
    )
    req = ChatRequest.builder().request_body(req_body).build()
    req_option = RequestOption.builder().api_key("<your-api-key>").build()
    response = client.chat.v1.chat.chat(req, req_option, True)
    # response = await client.chat.v1.chat.achat(req, req_option, True)
    for chunk in response:
        print(chunk)


if __name__ == "__main__":
    main()
```
nenlib 0.1.0
A library for LLM provider configuration and logging utilities
License: MIT
Requires Python: >=3.8

# nenlib

A library for LLM provider configuration and logging utilities.

## Installation

```bash
pip install nenlib
# or
uv add nenlib
```

## Usage

```python
from nenlib import PROVIDERS, MLopsConfig, LiteLLMConfig

# Access provider configurations
print(PROVIDERS)

# Use MLOps configuration
config = MLopsConfig.get_provider_config("openai")

# Generate LiteLLM configuration
lite_config = LiteLLMConfig(providers=PROVIDERS)
model_list = lite_config.generate_model_list()
```
mltracker 0.4.0
Track machine learning experiments.
License: MIT
Requires Python: <4.0,>=3.12

# MLTracker: Lightweight Machine Learning Experiment Tracker

MLTracker is a lightweight library for tracking machine learning experiments, models and metrics. It is a simple data model built on **TinyDB**. I create this for personal use but feel free to use it as you want.

📖 Full documentation: [API Reference](https://entropy-flux.github.io/MLTracker)   

## Installation

```bash
pip install mltracker
```

## Usage

### Create an Experiment

```python
from mltracker import getExperiment

experiment = getExperiment("my-experiment") # get or creates an experiment
print(experiment.id, experiment.name)
```

Add a model to track:

```python
model = experiment.models.create(hash="123456", name="model1")
model.modules.add(name="conv_layer", attributes={"type": "conv", "layers": 3})
model.modules.add(name="actv_layer", attributes={"type": "relu"})
model.modules.add(name="linear_layer", attributes={"in_size": 256, "out_size": 10})
```

Track metrics:

```python
model.metrics.add(name="accuracy", value=0.85, step=1, phase="train")
model.metrics.add(name="loss", value=0.25, step=1, phase="train") 
model.metrics.add(name="accuracy", value=0.87, step=1, phase="test")
model.metrics.add(name="loss", value=0.24, step=1, phase="test")
model.step += 1

model.metrics.add(name="accuracy", value=0.89, step=2, phase="train")
model.metrics.add(name="loss", value=0.29, step=2, phase="train")
model.metrics.add(name="accuracy", value=0.88, step=2, phase="test")
model.metrics.add(name="loss", value=0.26, step=2, phase="test")
model.step += 1
```

Track extra metadata:

```python
iteration = model.iterations.create(step=2)
iteration.modules.add(name="SGD", attributes={"lr"=0.01})
```

Then just retrieve what you need.

```python
model = experiment.models.read(hash="123456")
print(model.step)

for module in model.modules.list():
    print(module.name, module.attributes)

for metric in model.metrics.list(): 
    print(metric.name, metric.value)
```

This is MIT Licensed, feel free to use it as you please.