ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/thatstupidcomputer / packages/discovery/providers/perplexity/answers.ts

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/thatstupidcomputer / packages/discovery/providers/perplexity/answers.ts
DateNot specified in source
RepositoryJanady13/thatstupidcomputer
Revision57555cde46910102dd25d6c1c1fb2c359e9655bd
Branchmain
Path or archive memberpackages/discovery/providers/perplexity/answers.ts
Original SHA-256b572c91f23f8ba1616cc54570f61b0ac02ebf286a4e761ba1c123b3a81dbb31a
Git blob SHA851408e2c2e8b4361f8cd8f2abb9ed0bc1d9a656
Reading-copy SHA-256b572c91f23f8ba1616cc54570f61b0ac02ebf286a4e761ba1c123b3a81dbb31a

Original source ↗

Recovered source transcript

import {record,records,citationUrl,type AnswerAdapter} from '../../protocol.ts'; export const perplexityAnswers:AnswerAdapter={ endpoint:'https://api.perplexity.ai/v1/sonar',auth:'bearer', build:(model,query)=>({model,messages:[{role:'user',content:query}],max_tokens:1200,stream:false}), parse:value=>{ if(!record(value)||!Array.isArray(value.choices)||!Array.isArray(value.citations))return; const choice=records(value.choices)[0];if(!choice||choice.finish_reason!=='stop'||!record(choice.message)||typeof choice.message.content!=='string'||!choice.message.content.trim())return; // Native citations are sources used in generation; search_results is only retrieved context. const citations=value.citations.map(citationUrl).filter((url):url is string=>Boolean(url)).map(url=>({url})); return {text:choice.message.content,citations,searchExecuted:true,...(typeof value.model==='string'?{responseModel:value.model}:{})}; }, };

Search equations, builds, manuscript text, and recovered sources.