semvec/pypi-packages huggingface dataset:
k2-sandbox 0.1.2
Python SDK for running LLM-generated code in isolated Docker container environments
License: MIT
Requires Python: >=3.11

# K2 Sandbox

K2 Sandbox is a Python SDK for running LLM-generated code in isolated Docker container environments. It provides a secure way to execute untrusted code with filesystem access, network capabilities, and stateful execution.

## Features

- Secure code execution in isolated Docker containers
- Support for Python, JavaScript, and TypeScript execution
- Stateful execution (variable persistence between runs)
- File system operations
- Process management
- Terminal interaction

## Installation

```bash
pip install k2-sandbox
```

## Quick Start

```python
from k2_sandbox import Sandbox

# Optionally, set the API URL if needed
# This is useful if your API server is not at the default http://localhost:3000
# and you don't want to set it via environment variable or for every sandbox instance.
Sandbox.set_default_api_url("https://your-k2-api-server.com")

# Create and use a code interpreter sandbox
with Sandbox.create_code_interpreter() as sandbox:
    execution = sandbox.run_code("x = 41; x + 1")
    print(f"Result: {execution.text}")  # Output: 42
```

## Documentation

For detailed documentation, see the [API Reference](docs/api_reference.md).

## License

MIT
wordsim 0.1.2
This is simply a word similarity model that matches the desired word to the most similar word in a reference list of words provided by the user.
License: MIT
Requires Python: >=3.9

# wordsim
This is the source code of a smart model that finds the similarity between a given word and a reference list of words. Then it returns the word that has the most similarity.

## Code

```python
from wordsim import wordSim  # import the model.

lst = ['Red', 'Green', 'Blue']  # declare a list of reference words.

model = wordSim()  # create an instance of the class 'wordSim'.
model.train(lst)  # train the model.

test_word = 'gren'  # specify the required word to test.

results = model.predict(word=test_word, tunner=2)  # pass the 'test word' as an argument and tune the 'tunner' for best performance.

print(results)  # print the results.
print(model.get_best())  # or print the results that way.

#console:
{'word': 'gren', 'word_match': 'Green', 'status': 'successful', 'score': 0.3333333333333333}
{'word': 'gren', 'word_match': 'Green', 'status': 'successful', 'score': 0.3333333333333333}