Fixes for Bruces comments
Signed-off-by: Matt Williams <m@technovangelist.com>
This commit is contained in:
parent
3d8872bbbd
commit
9dd88dc040
@ -27,12 +27,12 @@ const attributeInfo: AttributeInfo[] = [
|
||||
]
|
||||
|
||||
|
||||
// Define the embeddings that will be used when adding the documents to the vector store
|
||||
// Define the model used to generate embeddings, these capture the context of the input data
|
||||
const embeddings = new HuggingFaceTransformersEmbeddings({
|
||||
modelName: "Xenova/all-MiniLM-L6-v2",
|
||||
});
|
||||
|
||||
// Create the Ollama model
|
||||
// Run the model using Ollama
|
||||
const llm = new Ollama({
|
||||
model: modelName
|
||||
})
|
||||
@ -58,9 +58,9 @@ const findArt = async () => {
|
||||
// query from the LLM used to retrieve the documents
|
||||
{
|
||||
handleLLMEnd(output) {
|
||||
console.log("llm end")
|
||||
const outout = output.generations[0][0].text.replace(/\\"/gm, "'").replace(/\n/gm, "")
|
||||
console.log(`output - ${JSON.stringify(outout, null, 2)}`)
|
||||
console.log("This is the output from the LLM after it has come up with a filter")
|
||||
const llmEndOutput = output.generations[0][0].text.replace(/\\"/gm, "'").replace(/\n/gm, "")
|
||||
console.log(`output - ${JSON.stringify(llmEndOutput, null, 2)}`)
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
@ -41,8 +41,7 @@ const fetchArtistWorkIds = async (artist: string): Promise<number[]> => {
|
||||
const response = await fetch(artistURL);
|
||||
const json = await response.json();
|
||||
const artistWorks: { id: number }[] = json.data;
|
||||
const justIds = artistWorks.map((work) => work.id);
|
||||
return justIds;
|
||||
return artistWorks.map((work) => work.id);
|
||||
}
|
||||
const embedding = new HuggingFaceTransformersEmbeddings({
|
||||
modelName: "Xenova/all-MiniLM-L6-v2",
|
||||
|
@ -34,7 +34,7 @@ There are a few things you need to do to enable Self Query Retrieval. First, the
|
||||
|
||||
## The code
|
||||
|
||||
There are two main parts to the code. First there is a GenerateSource.ts file and then there is a FindArt.ts file. Let's look at GenerateSource first.
|
||||
There are two main parts to the code. First there is a `GenerateSource.ts` file and then there is a `FindArt.ts` file. Let's look at GenerateSource first.
|
||||
|
||||
### GenerateSource
|
||||
|
||||
@ -108,4 +108,4 @@ To take this further, you could work on getting more out of the dataset. It turn
|
||||
|
||||
Maybe it makes more sense to move the artist name and title of the work into the document itself. Then add some more metadata (there are at least 100 other attributes in the raw API that aren't used in this example.)
|
||||
|
||||
Also try different models. In testing so far, it seems that codellama performs the best, but when a new model comes out you might try that.
|
||||
Also try different models. In testing so far, it seems that `codellama` produces more reliably useable filters. It's not perfect and can still create a filter that won't find anything. When a new code model comes out, you might try that to see if it performs better.
|
||||
|
Loading…
x
Reference in New Issue
Block a user