Skip to main content

fore ai packages

Project description

The fore client package

The foresight library within fore SDK allows you to easily evaluate the performance of your LLM system based on a variety of metrics.

You can sign-up and get started immediately at https://foresight.foreai.co.

Check our documentation at https://docs.foreai.co.

Quick start

  1. Install the package using pip:

    pip install fore
    

    Or download the repo from GitHub and install via pip install .

    • Get started with the following lines:
    from fore.foresight import Foresight
    
    foresight = Foresight(api_token="<YOUR_API_TOKEN>")
    
    foresight.log(query="What is the easiest programming language?",
                  response="Python",
                  contexts=["Python rated the easiest programming language"],
                  tag="my_awesome_experiment")
    
    # You can add more such queries using foresight.log
    # ....
    
    foresight.flush()
    
    • Or alternatively to curate your evalsets and run regular evals against them do:
    from fore.foresight import EvalRunConfig, Foresight, InferenceOutput, MetricType
    
    foresight = Foresight(api_token="<YOUR_API_TOKEN>")
    
    evalset = foresight.create_simple_evalset(
        evalset_id="programming-languages",
        queries=["hardest programming language?", "easiest programming language?"],
        reference_answers=["Malbolge", "Python"])
    
    run_config = EvalRunConfig(evalset_id="programming-languages",
                            experiment_id="my-smart-llm",
                            metrics=[MetricType.GROUNDEDNESS, 
                                     MetricType.REFERENCE_FACT_RECALL])
    
    
    def my_generate_fn(query: str) -> InferenceOutput:
        # Do the LLM processing with your model...
        # Here is some demo code:
        return InferenceOutput(
            generated_response="Malbolge" if "hardest" in query else "Python",
            contexts=[
                "Malbolge is the hardest language", "Python is the easiest language"
            ])
    
    foresight.generate_answers_and_run_eval(my_generate_fn, run_config)
    

Metrics

We currently offer two metrics:

Check here for more information.

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

fore-0.1.8.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

fore-0.1.8-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file fore-0.1.8.tar.gz.

File metadata

  • Download URL: fore-0.1.8.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.7

File hashes

Hashes for fore-0.1.8.tar.gz
Algorithm Hash digest
SHA256 ffec8a2f0a704570d86c2c46c0657ac919ce9be17bc10ee53eccb191e4c4766d
MD5 643c078cf2a160cdf790cb5009e93643
BLAKE2b-256 5a4555260eb93cb1aa03f9e1c2466e64291d8fe339a55e9b5421f82a74a80dba

See more details on using hashes here.

File details

Details for the file fore-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: fore-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.7

File hashes

Hashes for fore-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 5780fcdd7391e1e250ea7ac2aea6e09c2621dbdfe541e57717919e19112c2bd2
MD5 17718b5712c3e4deb6ba3ed86e8d851c
BLAKE2b-256 5b4882d2b78859acbc81dc611b6e46756e5bab41bf52b5292dba90322cbf9cfc

See more details on using hashes here.

Supported by

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