semvec/pypi-packages huggingface dataset:
easy-open-ai 0.2.0
This is my first REAL package.
Requires Python: >=3.11,<4.0

# _Welcome to my OpenAI Playground!_

Making `Open AI` even easier.

_STILL ACTIVELY DEVELOPING_

## How to play

- `pip install easy-open-ai`
- in your working folder, create `.env` file with `OPENAI_API_KEY=`, or make such environment variable
- enjoy! `from easy_open_ai import` ...

  #### Version 0.1.6

  + `get_picture(text, save=True)` *(as b64_json string)*
  + `get_n_pictures(text, n=3)`
  
  + `get_answer(question)`
  + `correct_grammar(text)`

  #### Version 0.1.7

  + `get_picture_url(text)` *(url lives 1 hour)*
  + `get_n_pictures_urls(text, n=3)`

  + `is_harmful_text(text)` *(sometimes ignores censorship escaping: '@' instead of 'a', etc)*
  + `how_many_text_tokens(text)` *(most of this package works with text no longer than 1024 text-tokens, it's recommended for validating the text length)*
  
  + `sum_up_as_haiku(text)`
  + `get_poem(text)`
  + `get_answer_as_poem(question)`
  + `autocomplete_text(text)`
  
  + `translate_text(text, language='Ukrainian')`
  + `get_answer_with_instruction(question,instruction,
            chaos_coefficient=0.5,
            model="gpt-3.5-turbo",
            max_tokens=1024)`

  #### Version 0.1.8

  *ADDED LIVE TEXT DISPLAYING*

  + `get_answer_with_instruction_stream(question)` *(it's a generator)*
  
  *to get chatGPT-like live text generation, add `_stream` to the name, for example, `aget_answer_as_poem_stream(question)`*

  **!not all of the available text functions have this yet**

#### Version 0.1.9

+ Automatic documentation for your function and **FastAPI endpoints** in a python file with `docstring file_name.py` terminal command (or `docstring path\to\file_name.py `). If the docstring is already present, it will **NOT** overwrite it.

More easy functions coming soon!

_For `async` version of a function, add `a` in front, for example, `aget_picture(text)` instead of `get_picture(text)`._
HexaLog 0.6.0
HexaLog is a logging port and set of opinionated adapters meant to simplify using a logger in a hexagonal architecture.
Requires Python: >=3.10,<4.0

# HexaLog

HexaLog is a logging port and set of opinionated adapters meant to simplify using a logger in a hexagonal architecture.

## Why

In hexagonal architecture dependencies external dependencies should be injected to adapters and the service at runtime. This means business logic doesn't directly depend on external concerns which can (arguably) make code easier to test and maintain. A logger is an external dependency, therefor it to can be passed into a service or adapter at runtime.

![HexaLog Example](https://cdn.ericcbonet.com/python-hexalog-example.png)

## Installation

```bash
pip install hexalog
```

## Usage

For production environments hexalog wraps [structlog](https://www.structlog.org/en/stable/) and provides a `structlog` adapter.

From development environments hexalog wraps the standard library `logging` module and provides a `logging` adapter.

If you have some service or adapter then make the logger port a dependency of that class:

```python
from hexalog.ports import Logger

class SomeService:
    def __init__(self, logger: Logger):
        self.logger = logger

    def do_something(self):
        self.logger.info("Doing something")
```

Then in your entrypoint to the application where you wire up your dependencies you can inject a logger like so:

```python
import os

from some_service import SomeService
from hexalog.adapters.struct_logger import StructLogger

log_level = os.getenv("LOG_LEVEL", "DEBUG")

logger = StructLogger(log_level=log_level)
# If you want to use the cli logger then you just need to inject that one
# logger = CliLogger(log_level=log_level)

service = SomeService(logger=logger)

service.do_something()
```

See the `examples` directory for more information.