Observability
Observe results
Observability
Observe results
Observe top 100-200 results from your existing pipeline, score on top 5
POST
/
observe
Copy
import { PongoClient } from 'pongo-typescript'
// Install with npm i pongo-typescript
// Replace the key with your actual API key
const pongoClient = new PongoClient("${private_key || 'loading key...'}")
const queries = ["What color are apples?", "Who made the first mobile phone?", "How many hearts do squids have?"]
// pass in the top ~100-200 results from your existing pipeline, passing more results will catch more edge cases
const listsOfResults = [
['Oranges are normally orange, unlike apples', 'Grapes can be purple or green', 'Apples can be green or red.', "If an apple is brown, it's best not to eat it."], // Apples results
['Apple released the first iPhone on June 29, 2007', 'The telephone was invented by Alexander Graham Bell in 1876.', 'The first long-distance telephone call was made in August 1876, between Brantford and Paris, Ontario', 'The newest iPhone models are the iPhone 15, it was released on September 22, 2023', 'The first handheld mobile phone was the Motorola DynaTAC 8000X', 'Martin Cooper, an engineer at Motorola, is credited with inventing the first handheld cellular mobile phone and making the first mobile phone call'], // Mobile phone results
['Octopuses have three hearts.', "A squid's systemic (main) heart has three chambers.", 'The creature with the most hearts is the earthworm, with 10.', 'Squids have three hearts- one systemic (main) heart and two branchial hearts'] // squids results
]
for (let i = 0; i < queries.length; i++) {
// You'll get an email report once the queries are finished processing and they'll be available for view and download through the analytics dashboard.
// You'll be able to query observability results by the log_metadata field
pongoClient.observe({
docs: listsOfResults[i],
query: queries[i],
logMetadata: {source: 'Pongo Tutorial'}
}).then(res => console.log(res.data))
}
Copy
{
"status": "success"
}
If you want to improve your search results while still observing accuracy, check out the /filter endpoint
Authorizations
Body
application/json
Query that was initally passed into your pipeline
Unique ID for the document, this field can be renamed using the key_field variable
Example:
"doc-id"
metadata that is used in scoring, this field can be renamed using the public_metadata_field variable
Example:
""
default field being scored on, this can be changed using the text_field param
Response
200 - application/json
A successful response indicating the update of a sub-organization.
Example:
"success"
Copy
import { PongoClient } from 'pongo-typescript'
// Install with npm i pongo-typescript
// Replace the key with your actual API key
const pongoClient = new PongoClient("${private_key || 'loading key...'}")
const queries = ["What color are apples?", "Who made the first mobile phone?", "How many hearts do squids have?"]
// pass in the top ~100-200 results from your existing pipeline, passing more results will catch more edge cases
const listsOfResults = [
['Oranges are normally orange, unlike apples', 'Grapes can be purple or green', 'Apples can be green or red.', "If an apple is brown, it's best not to eat it."], // Apples results
['Apple released the first iPhone on June 29, 2007', 'The telephone was invented by Alexander Graham Bell in 1876.', 'The first long-distance telephone call was made in August 1876, between Brantford and Paris, Ontario', 'The newest iPhone models are the iPhone 15, it was released on September 22, 2023', 'The first handheld mobile phone was the Motorola DynaTAC 8000X', 'Martin Cooper, an engineer at Motorola, is credited with inventing the first handheld cellular mobile phone and making the first mobile phone call'], // Mobile phone results
['Octopuses have three hearts.', "A squid's systemic (main) heart has three chambers.", 'The creature with the most hearts is the earthworm, with 10.', 'Squids have three hearts- one systemic (main) heart and two branchial hearts'] // squids results
]
for (let i = 0; i < queries.length; i++) {
// You'll get an email report once the queries are finished processing and they'll be available for view and download through the analytics dashboard.
// You'll be able to query observability results by the log_metadata field
pongoClient.observe({
docs: listsOfResults[i],
query: queries[i],
logMetadata: {source: 'Pongo Tutorial'}
}).then(res => console.log(res.data))
}
Copy
{
"status": "success"
}