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.1.1.tar.gz (4.1 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.1.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for prolog_env-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5170c53cae8ae58a8c6073da7d29aad1d0d2a159ba660e08c4e53a45ea2f9167
MD5 4ff2e2445adc59fe53d789b1973032d0
BLAKE2b-256 ff96e4409c347f69bcb3a28c80b437bfa74050e2c0923d2e8adeab63fb5919fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for prolog_env-0.1.1.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.1.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for prolog_env-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 334632cb3508141ce4d6839e6977d032612e162cd47794f88dec611ffd3ead88
MD5 551f4dc035fb304a285b5c24b154d26d
BLAKE2b-256 b4e6efa51ac03e17350c4dd573c3bea0ad9dd898f435b577f42465b268327e63

See more details on using hashes here.

Provenance

The following attestation bundles were made for prolog_env-0.1.1-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