This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using HTTP, JSON3 | |
"Call the OpenAI JSON API and return the results." | |
function gpt3_api_call( | |
prompt, n_completions::Int=1; | |
endpoint::String = "https://api.openai.com/v1/completions", | |
api_key::String = get(ENV, "OPENAI_API_KEY", ""), | |
organization::String = get(ENV, "OPENAI_ORGANIZATION", ""), | |
n_retries::Int = 10, | |
model::String = "text-davinci-003", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Documenter, PDDL | |
# Include workaround to inject custom meta tags | |
include("metatags.jl") | |
# Add custom metatags | |
empty!(CUSTOM_META_TAGS) | |
PREVIEW_IMAGE_URL = | |
"YOUR PREVIEW URL HERE" | |
SITE_DESCRIPTION = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A Julia implementation of the random Blocksworld state generation algorithm presented in Figure 2 of [1]. | |
Note that this implementation fixes a minor bug in the pseudo-code provided by [1]. | |
[1] Slaney, J. and Thiébaux, S., 2001. Blocks World Revisited. Artificial Intelligence, 125(1-2), pp.119-153. | |
DOI: https://doi.org/10.1016/S0004-3702(00)00079-5 | |
""" | |
"Number of states with `N` blocks." | |
function nstates(N::Int) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Gen | |
using Distributions: truncated | |
struct TruncatedNormal <: Gen.Distribution{Float64} end | |
""" | |
trunc_normal(mu::Real, std::Real, lb::Real, ub::Real) | |
Samples a `Float64` value from a normal distribution. | |
""" | |
const trunc_normal = TruncatedNormal() |