We have a few use cases that need an extra place to stash information--mainly for results from Library.query().
for example, we need a way to pass back:
Number of chunks returned (for the case where omit='*' is true, and the actual chunks are not returned)
Number of chunks that would have been included because the person didn't pass sufficient access_token (if the host server opts in to revealing that)
A message that should be displayed to clients reading this library (in the Library() constructor if it sees a message it should print it)
Probably the easiest way is to add a details dict to the library format that's optional:
{
//...
//details is optional. It's typically only included in libraries generated by Library.query()
"details": {
//If message is provided, then any time this library is loaded via Library(), it will print that message to the console. This is useful for example to say "This library included some content that was filtered out. Contact alex@komoroske.com for an access key"
"message": "A message",
//Counts and all keys inside are optional
"counts": {
//How many chunks are included in the `content`, or would have been had they not been omitted.
"chunks": 5
//How many chunks were filtered out because they didn't match the filter criteria
"filtered": 2,
//How many chunks were filtered out because you didn't pass an access_token that had sufficient access. Hosts by default do not divulge this, but some choose to.
"restricted": 3
}
}
//...
}
We have a few use cases that need an extra place to stash information--mainly for results from Library.query().
for example, we need a way to pass back:
Probably the easiest way is to add a
details
dict to the library format that's optional: