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.4.tar.gz (4.2 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.4-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: prolog_env-0.1.4.tar.gz
  • Upload date:
  • Size: 4.2 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.4.tar.gz
Algorithm Hash digest
SHA256 01d2b51e99b366098ca8731f3efd33a9af412453910466f7ba163450357c0f56
MD5 3a69dba0177078920a4108965cf5656b
BLAKE2b-256 b78db73185ccd77dd051e222c0c06396d6987500f307e64abadfe6db3999a3f5

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: prolog_env-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3814914325b0aa3b1f74eb0ffbb5cec97c7613ef78e0df1e87a0b25a3305fdfe
MD5 e3cd72c77cf0afc1e817419e060589a3
BLAKE2b-256 1819581686b47353df662b059c8ec2aa43ac6d53e8e456adca5d9c642e7b9032

See more details on using hashes here.

Provenance

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