mirror of
https://github.com/wassname/rag_search_cite.git
synced 2026-06-27 15:16:30 +08:00
working, withotu search
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 339 KiB After Width: | Height: | Size: 302 KiB |
+61
-11
@@ -47,6 +47,65 @@ function Progress({ data }) {
|
||||
}
|
||||
|
||||
|
||||
const defaultDocs = [
|
||||
{
|
||||
"name": "Fluids and flows in brain cancer and neurological disorders",
|
||||
"url": "https://wires.onlinelibrary.wiley.com/doi/full/10.1002/wsbm.1582",
|
||||
"content": "1 INTRODUCTION 1.1 Brain fluid compartments. The brain interstitial space is a dynamic location between the parenchymal cells and vasculature, which provides the fluid and structural environment to support cellular functions.",
|
||||
"query": "(\"Computational neuroscience methods\" OR \"neural computation techniques\" OR \"neuroinformatics tools\" OR \"simulation methods in neuroscience\") AND (\"MechInterp\" OR \"Mechanical Interpretation\" OR \"Mechanical interpretation tools\" OR \"Mechanical interpretation strategies\")",
|
||||
"source": "bing",
|
||||
"rank": "01"
|
||||
},
|
||||
{
|
||||
"name": "Frontiers | Individual Differences in Math Ability Determine ...",
|
||||
"url": "https://www.frontiersin.org/journals/human-neuroscience/articles/10.3389/fnhum.2019.00227/full",
|
||||
"content": "In the analysis of ER, significant main effects were observed for complexity (F 1,29 = 241.31, p < 0.001, η p 2 = 0.893), math ability (F 1,29 = 14.06, p = 0.001, η p 2 = 0.327) and operation (F 1,29 = 7.01, p = 0.013, η p 2 = 0.195), indicating higher ER for complex compared to simple arithmetic problems, for individuals with low compared to high math ability, and for division compared to ...",
|
||||
"query": "(\"Computational neuroscience methods\" OR \"neural computation techniques\" OR \"neuroinformatics tools\" OR \"simulation methods in neuroscience\") AND (\"MechInterp\" OR \"Mechanical Interpretation\" OR \"Mechanical interpretation tools\" OR \"Mechanical interpretation strategies\")",
|
||||
"source": "bing",
|
||||
"rank": "11"
|
||||
},
|
||||
{
|
||||
"name": "Machine learning and artificial intelligence in neuroscience: A primer ...",
|
||||
"url": "https://www.sciencedirect.com/science/article/pii/S0889159123003380",
|
||||
"content": "Neuro-gastroenterology is a field with challenges that make it particularly suited to attempt machine learning approaches: for better understanding of the underlying mechanisms, using microbiomic and metabolomic datasets results in high-dimensional data, which needs to be integrated with multiple levels of patient-reported outcomes or imaging ...",
|
||||
"query": "MechInterp, a mechanical interpretation model, can leverage various computational neuroscience techniques for enhanced problem-solving. This includes methods like neural simulations to experiment with different mechanical interpretations, computational modeling to represent complex mechanical systems, and data analysis algorithms to glean insights from large neuroscience datasets. Additionally, techniques such as machine learning algorithms can be applied to interpret and predict mechanical patterns based on neuroscientific data. Network theory may also assist in understanding the complexity and connectivity within mechanical systems by adopting principles from neuroscience.\n",
|
||||
"source": "bing",
|
||||
"rank": "21"
|
||||
},
|
||||
{
|
||||
"name": "Neurocomputing | Frontiers in Graph Computation: Techniques, Challenges ...",
|
||||
"url": "https://www.sciencedirect.com/special-issue/102H7QVSWQG",
|
||||
"content": "In the realm of data representation, graphs stand out as one of the most ubiquitous and versatile structures. The onset of the digital age, characterized by the surge of online platforms, IoT devices, and interconnected systems, has led to a monumental increase in the generation and availability of graph data. This vastness of data, often termed as 'Big Data', coupled with its ...",
|
||||
"query": "(\"Computational neuroscience methods\" OR \"neural computation techniques\" OR \"neuroinformatics tools\" OR \"simulation methods in neuroscience\") AND (\"MechInterp\" OR \"Mechanical Interpretation\" OR \"Mechanical interpretation tools\" OR \"Mechanical interpretation strategies\")",
|
||||
"source": "bing",
|
||||
"rank": "31"
|
||||
},
|
||||
{
|
||||
"name": "Development of Novel Neurotechnologies and Computational Models for ...",
|
||||
"url": "https://acm-stag.literatumonline.com/doi/10.5555/AAI28862915",
|
||||
"content": "Author: Xin Liu. University of California, San Diego, Advisor: Kuzum, Duygu. University of California, San Diego, Committee Members: Cauwenberghs, Gert",
|
||||
"query": "(\"Computational neuroscience methods\" OR \"neural computation techniques\" OR \"neuroinformatics tools\" OR \"simulation methods in neuroscience\") AND (\"MechInterp\" OR \"Mechanical Interpretation\" OR \"Mechanical interpretation tools\" OR \"Mechanical interpretation strategies\")",
|
||||
"source": "bing",
|
||||
"rank": "41"
|
||||
},
|
||||
{
|
||||
"name": "Holdings: Computational neuroscience and cognitive modelling ...",
|
||||
"url": "https://librarysearch.aut.ac.nz/vufind/Record/1497141/TOC?sid=28864735",
|
||||
"content": "Computational neuroscience and cognitive modelling : a student's introduction to methods and procedures / Britt Anderson.",
|
||||
"query": "(\"Computational neuroscience methods\" OR \"neural computation techniques\" OR \"neuroinformatics tools\" OR \"simulation methods in neuroscience\") AND (\"MechInterp\" OR \"Mechanical Interpretation\" OR \"Mechanical interpretation tools\" OR \"Mechanical interpretation strategies\")",
|
||||
"source": "bing",
|
||||
"rank": "51"
|
||||
},
|
||||
{
|
||||
"name": "Computational Neuroscience - PMC - National Center for Biotechnology ...",
|
||||
"url": "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3966414/",
|
||||
"content": "This special issue of Computational Neuroscience (CN) includes 15 original articles, which have been selected from the highest quality submissions.",
|
||||
"query": "(\"Computational neuroscience methods\" OR \"neural computation techniques\" OR \"neuroinformatics tools\" OR \"simulation methods in neuroscience\") AND (\"MechInterp\" OR \"Mechanical Interpretation\" OR \"Mechanical interpretation tools\" OR \"Mechanical interpretation strategies\")",
|
||||
"source": "bing",
|
||||
"rank": "61"
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
function App() {
|
||||
const [count, setCount] = useState(0)
|
||||
@@ -54,12 +113,7 @@ function App() {
|
||||
const [prompt, setPrompt] = useState(defaultPrompts[0])
|
||||
const [reply, setReply] = useState(`"**Post-Hoc Interpretability Techniques**: [1, 2, 3] These techniques are applied after the model has been trained to gain insights into its behavior and decision-making processes. They include efforts to uncover general,[2, 4] transferable principles across models and tasks, as well as automating the discovery and interpretation of critical circuits in trained models [4].".`)
|
||||
const [status, setStatus] = useState(null)
|
||||
const [docs, setDocs] = useState([
|
||||
{ name: 'name', url: 'localhost', content: 'c1', rank: 2, q: '1', source: 'bing' },
|
||||
{ name: 'name', url: 'localhost', content: 'c2', rank: 5 },
|
||||
{ name: 'name', url: 'localhost', content: 'c3', rank: 10 },
|
||||
{ name: 'name', url: 'localhost', content: 'c4', rank: 7 },
|
||||
])
|
||||
const [docs, setDocs] = useState(defaultDocs)
|
||||
const [openaiModel, setOpenAIModel] = useState('gpt-4')
|
||||
|
||||
|
||||
@@ -70,10 +124,6 @@ function App() {
|
||||
<Col sm={4}>
|
||||
<Row>
|
||||
|
||||
<SelectPrompt value={prompt} onChange={setPrompt} />
|
||||
</Row><Row>
|
||||
|
||||
|
||||
<Form>
|
||||
<FloatingLabel label="OPENAI_KEY:"
|
||||
>
|
||||
@@ -124,7 +174,7 @@ function App() {
|
||||
<Col sm={8}>
|
||||
<Row>
|
||||
<Form onSubmit={e => e.preventDefault()}>
|
||||
<Editor name="Search" value={input} onChange={(e) => setInput(e.target.value)} />
|
||||
<Editor name="Search" value={input} onChange={(e) => setInput(e.target.value)} rows="3" />
|
||||
<Button
|
||||
variant="primary"
|
||||
onClick={() => setCount(() => search(input, openaiModel, setReply, setStatus, setDocs))}>
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function Editor({ name, value, onChange, rows }) {
|
||||
|
||||
<Form.Label htmlFor={name} label={name}><h4>{name}</h4></Form.Label>
|
||||
<Form.Control as="textarea"
|
||||
id={name} rows={rows || 8}
|
||||
id={name} rows={rows || 4}
|
||||
type="text"
|
||||
value={value}
|
||||
placeholder={name}
|
||||
|
||||
+7
-5
@@ -61,7 +61,7 @@ function rank(query, r1, r2, r3, model = defaultModel) {
|
||||
return r.split(' > ').map(s => s.trim().replace('[', '').replace(']', '')).map(s => parseInt(s)).filter(s => !isNaN(s)).reverse()
|
||||
})
|
||||
.then(ranks => {
|
||||
// TODO check that the list if complete
|
||||
// check that the list if complete
|
||||
if (ranks.length != num) {
|
||||
return Promise.reject(`The number of provided passages does not match the number of expected passages. ${ranks.length}!=${num}`)
|
||||
}
|
||||
@@ -69,9 +69,10 @@ function rank(query, r1, r2, r3, model = defaultModel) {
|
||||
|
||||
|
||||
let rankedDocs = []
|
||||
for (let i in ranks) {
|
||||
let doc = docs[ranks[i] - 1]
|
||||
rankedDocs.push({content: doc, rank: i + 1})
|
||||
for (let ri in ranks) {
|
||||
ri = parseInt(ri)
|
||||
let doc = docs[ranks[ri] - 1]
|
||||
rankedDocs.push({...doc, rank: ri})
|
||||
}
|
||||
return rankedDocs
|
||||
})
|
||||
@@ -86,8 +87,9 @@ function answer_with_docs(query, rankedDocs, model = defaultModel) {
|
||||
{ role: "assistant", content: `Okay, I an ready to carefully consider the first document and how I can use it to answer your query.` },
|
||||
]
|
||||
for (let i in rankedDocs) {
|
||||
i = parseInt(i)
|
||||
let d = rankedDocs[i]
|
||||
messages.push({ role: "user", content: `[${i + 1}]Title: ${d.name}:\n\nContent: ${d.content}\n\nUrl:${d.url}` })
|
||||
messages.push({ role: "user", content: `[${i}]Title: ${d.name}:\n\nContent: ${d.content}\n\nUrl:${d.url}` })
|
||||
messages.push({ role: "assistant", content: `I have considered passage [${parseInt(i) + 1}]. Next please.` })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user