Skip to content

Commit

Permalink
fix arweave downloader, add prompt test [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
erhant committed Dec 31, 2024
1 parent 3b92a57 commit ad2bea9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
7 changes: 3 additions & 4 deletions misc/arweave.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ if (!input) {
if (input.startsWith("0x")) {
input = input.slice(2);
}

// decode to arweave url
const inputDecoded = Buffer.from(input, "hex").toString();
const arweaveTxid = Buffer.from(inputDecoded, "hex").toString("base64url");
const obj = JSON.parse(inputDecoded);

// download the actual response from Arweave
const url = `https://arweave.net/${arweaveTxid}`;
const url = `https://arweave.net/${obj.arweave}`;
console.log(url);
const res = await fetch(url);

console.log(await res.text());
17 changes: 17 additions & 0 deletions src/compute/generation/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,21 @@ mod tests {
println!("Output:\n{}", output);
assert!(output.contains('4'));
}

#[tokio::test]
#[ignore = "run this manually"]
async fn test_raw_workflow() {
// cargo test --package dria-oracle --lib --all-features -- compute::generation::execute::tests::test_raw_workflow --exact --show-output --ignored
dotenvy::dotenv().unwrap();

let contract_result = hex_literal::hex!("7b2261727765617665223a2239397a4252676c4c663443696b35676c57444f667542463736456e417a4a6344303431545a614c6d6f6934227d");
let request = GenerationRequest::try_parse_bytes(&contract_result.into())
.await
.unwrap();
let output = execute_generation(&request, Model::GPT4oMini, None)
.await
.unwrap();

println!("{}", output);
}
}

0 comments on commit ad2bea9

Please sign in to comment.