Skip to main content

A Python package providing an environment for AI agents to test their Prolog code.

Project description

prolog-env

PyPI version License

A Python package providing an environment for AI agents to test their Prolog code.

Installation

The package depends on SWI-Prolog, to install SWI-Prolog from PPA:

sudo apt-add-repository ppa:swi-prolog/stable
sudo apt-get update
sudo apt-get install swi-prolog libpython3-dev

Install the package using pip:

pip install prolog-env

Get started

This guide provides a quick introduction to using the prolog_env package. It demonstrates how to create and interact with the SimpleEvaluator environment.

from prolog_env import SimpleEvaluator

env = SimpleEvaluator()

code = """
train('Amsterdam', 'Haarlem').
train('Amsterdam', 'Schiphol').
"""

observation, reward, terminated, truncated, info = env.step(code)

print("Observation:")
print(observation)
print("Reward:", reward)

tests = """
:- begin_tests(test).

test(a) :-
        A is 2^3,
        assertion(float(A)),
        assertion(A == 9).

:- end_tests(test).
"""

observation, reward, terminated, truncated, info = env.step(code, tests)

print("Observation:")
print(observation)
print("Reward:", reward)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prolog_env-0.0.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prolog_env-0.0.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file prolog_env-0.0.2.tar.gz.

File metadata

  • Download URL: prolog_env-0.0.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for prolog_env-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a8cf44cd45d2d8311c7a7cfdb8a65e210474f84957cef607c0d06310b6b16276
MD5 57d131032313766dc803898fe6a2c4f8
BLAKE2b-256 471487899216cf6c3c9316500b2955795bf0bc8b794e6c3000a8cc75e2bea12d

See more details on using hashes here.

Provenance

The following attestation bundles were made for prolog_env-0.0.2.tar.gz:

Publisher: python-publish.yml on NewJerseyStyle/prolog-env

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file prolog_env-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: prolog_env-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for prolog_env-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1e65e72fb089c1ca40a85ef8b17003c15b466c960b6e887e4644bc16d225e756
MD5 5da80c81e685ca6674caf321c886ae3c
BLAKE2b-256 7b15944c013491739bd8ee44b63b4e755b7ad3deba1f2e93efd01d7dbf7176da

See more details on using hashes here.

Provenance

The following attestation bundles were made for prolog_env-0.0.2-py3-none-any.whl:

Publisher: python-publish.yml on NewJerseyStyle/prolog-env

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page