-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'ddf0fc0737d7287c53b85f8342699e487e22f45c' into staging
- Loading branch information
Showing
32 changed files
with
640 additions
and
474 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export const vosColors = [ | ||
"#d62728", | ||
"#2ca02c", | ||
"#1f77b4", | ||
"#bcbd22", | ||
"#9467bd", | ||
"#17becf", | ||
"#ff7f0e", | ||
"#8c564b", | ||
"#e377c2", | ||
"#ff9896", | ||
"#98df8a", | ||
"#aec7e8", | ||
"#dbdb8d", | ||
"#c5b0d5", | ||
"#9edae5", | ||
"#ffbb78", | ||
"#c49c94", | ||
"#f7b6d2", | ||
] |
12 changes: 0 additions & 12 deletions
12
client/src/api/networks/utils.ts → client/src/api/networks/_utils/functions.ts
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
2 changes: 1 addition & 1 deletion
2
client/src/api/networks/info.ts → client/src/api/networks/network/info.ts
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import MistralClient, { ResponseFormats } from "@mistralai/mistralai" | ||
|
||
const ENABLED = false | ||
const mistral = new MistralClient("OpLulxlAWDbZuIUNOLtdQwlNaXw8iKNw") | ||
|
||
async function mistralLabelsFromDomains(domains: any): Promise<string> { | ||
const completion = await mistral.chat({ | ||
messages: [ | ||
{ | ||
role: "user", | ||
content: ` | ||
You have been tasked with naming distinct fields of study for several communities of research publications. | ||
Below are lists of topics representing each community. | ||
Your goal is to provide a unique and descriptive name for each field of study that best encapsulates the essence of the topics within that community. | ||
Each name should be unique and as short as possible. | ||
Output as JSON object with the list number and the single generated name. | ||
${domains}`, | ||
}, | ||
], | ||
model: "open-mistral-7b", | ||
temperature: 0.3, | ||
responseFormat: { type: "json_object" as ResponseFormats }, | ||
randomSeed: 42, | ||
}) | ||
|
||
console.log("mistral_completion", completion) | ||
const answer: string = completion.choices[0].message.content | ||
return answer | ||
} | ||
|
||
export async function openAiLabeledClusters(clusters: Array<any>) { | ||
if (!ENABLED) return clusters | ||
|
||
const prefix = "list" | ||
const domains = clusters?.reduce((acc, cluster, index) => { | ||
if (cluster?.domains) { | ||
const topDomains = Object.entries(cluster.domains) | ||
.sort((a: [string, number], b: [string, number]) => b[1] - a[1]) | ||
.slice(0, 10) | ||
.map(([domain]) => `${domain}`) | ||
.join(", ") | ||
|
||
acc = acc + `${prefix}${index + 1} = [${topDomains}], ` | ||
} | ||
return acc | ||
}, "") | ||
console.log("domains", domains) | ||
|
||
if (!domains) return clusters | ||
|
||
const mistral_labels = await mistralLabelsFromDomains(domains).then((response) => JSON.parse(response)) | ||
console.log("mistral_labels", mistral_labels) | ||
|
||
Object.entries(mistral_labels).forEach((entries, index) => { | ||
const value = entries[1] | ||
clusters[index].label = Array.isArray(value) ? value[0] : value | ||
}) | ||
|
||
return clusters | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.