Code
This code gets all prompts from a Latitude project.import { Latitude } from '@latitude-data/sdk'
async function run() {
const sdk = new Latitude(process.env.LATITUDE_API_KEY, {
projectId: Number(process.env.PROJECT_ID),
versionUuid: 'live',
})
const response = await sdk.prompts.getAll()
// You can also pass a specific projectId and versionUuid other
// than the one you are using in the sdk
// const response = await sdk.prompts.getAll({
// projectId: 123,
// versionUuid: 'some-version-uuid',
// })
console.log(
'Prompts: ',
response.map((p) => p.path),
)
}
run()
import asyncio
import os
from latitude_sdk import Latitude, LatitudeOptions
async def run():
api_key = os.getenv("LATITUDE_API_KEY")
sdk_options = LatitudeOptions(
project_id=int(os.getenv("PROJECT_ID")),
version_uuid="live",
)
sdk = Latitude(api_key, sdk_options)
results = await sdk.prompts.get_all()
# You can pass different project_id or version_uuid
# results = await sdk.prompts.get_all(
# GetAllPromptsOptions(
# project_id=123,
# version_uuid=VERSION_UUID
# )
paths = [result.path for result in results]
print(paths, "\n" * 2)
asyncio.run(run())