import os
from scale_gp import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
page = client.knowledge_bases.chunks.list(
knowledge_base_id="knowledge_base_id",
)
page = page.chunks[0]
print(page.chunk_id){
"chunks": [
{
"chunk_id": "<string>",
"text": "<string>",
"embedding": [
123
],
"metadata": {},
"user_supplied_metadata": {},
"attachment_url": "<string>",
"title": "<string>"
}
]
}Get chunks from a knowledge base using chunk IDs or a matching metadata field. This API will query from the Vector Database using the passed in filters and optionally can return the embeddings.
This API can be used to get a list of chunks from a knowledge base. Given a chunk id, a metadata field and value, or both, matching chunks are searched for in the knowledge base given by knowledge base id.
import os
from scale_gp import SGPClient
client = SGPClient(
api_key=os.environ.get("SGP_API_KEY"), # This is the default and can be omitted
)
page = client.knowledge_bases.chunks.list(
knowledge_base_id="knowledge_base_id",
)
page = page.chunks[0]
print(page.chunk_id){
"chunks": [
{
"chunk_id": "<string>",
"text": "<string>",
"embedding": [
123
],
"metadata": {},
"user_supplied_metadata": {},
"attachment_url": "<string>",
"title": "<string>"
}
]
}Optional search by chunk_id
Optional search by metadata fields, encoded as a JSON object
Maximum number of chunks returned by the get_chunks endpoint. Defaults to 10 and cannot be greater than 2000.
1 <= x <= 2000Successful Response
List of chunks that match the chunk_id and metadata filters
Show child attributes