Advertisement
mattwk

Untitled

Nov 1st, 2024 (edited)
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.75 KB | None | 0 0
  1. Call (using
  2. import { createOpenRouter } from '@openrouter/ai-sdk-provider';
  3. import { generateObject } from 'ai';):
  4.  
  5. const response = await generateObject({
  6. model: 'openai/chatgpt-4o-latest',
  7. schema: z.any(),
  8. output: 'object',
  9. mode: 'json',
  10. system: contentSystem,
  11. seed: seed,
  12. });
  13.  
  14. ___________
  15.  
  16. Response (via console.log(response):
  17.  
  18. DefaultGenerateObjectResult {
  19. object: {
  20. story: [
  21. "Determined to gather allies for the perilous journey ahead, you turn to the villagers, your eyes scanning the crowd for those who might be willing to join you. The festive atmosphere has dimmed, but the spirit of Christmas still lingers in the air, a fragile hope that you must protect. You approach the older woman with silver hair, the one who had spoken of the Frost King's growing power. 'We need to act quickly,' you say, your voice firm. 'I can't do this alone. Who among you will stand with me?'",
  22. "The woman nods, her expression resolute. 'I will help in any way I can,' she says. 'My name is Elara, and I have lived in this village for many years. I know the Frozen Forest well, though I have never ventured deep into its heart. I can guide you to its edge, but beyond that, you will need others to face the dangers within.' She turns to the crowd, her voice rising. 'Who else will join Matt in this fight? Who will help save Christmas?'",
  23. "For a moment, there is silence, the villagers exchanging nervous glances. Then, a young elf steps forward, his green tunic dusted with snow. 'I'll go,' he says, his voice trembling slightly but filled with determination. 'My name is Finn, and I may not be the strongest, but I know how to craft things. If we need tools or weapons, I can help.' His words seem to embolden others, and soon, a burly man with a thick beard and a hammer slung over his shoulder steps forward. 'Name's Thorne,' he grunts. 'I'm a blacksmith. If we're going to face the Frost King's minions, you'll need someone who can forge weapons strong enough to withstand the cold.'",
  24. "More villagers begin to step forward, offering their skills and support. A healer named Mira, who promises to tend to any wounds you might suffer. A pair of twin elves, skilled in archery, who vow to protect you from the Frost King's icy minions. Slowly but surely, a small but determined group forms around you, their faces set with resolve. You feel a surge of hope—perhaps, with their help, you can truly stand a chance against the Frost King. 'Thank you,' you say, your voice filled with gratitude. 'Together, we will stop him.'"
  25. ],
  26. next: [
  27. 'Prepare supplies for the journey',
  28. 'Talk to Elara about the Frozen Forest',
  29. 'Set out for the Frozen Forest'
  30. ]
  31. },
  32. finishReason: 'stop',
  33. usage: { promptTokens: 4959, completionTokens: 544, totalTokens: 5503 },
  34. warnings: [],
  35. experimental_providerMetadata: undefined,
  36. response: {
  37. id: 'aiobj-tyRFZx....',
  38. timestamp: 2024-11-01T22:04:44.669Z,
  39. modelId: 'openai/chatgpt-4o-latest',
  40. headers: {
  41. 'access-control-allow-credentials': 'true',
  42. 'access-control-allow-headers': 'Authorization, User-Agent, X-Api-Key, X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, HTTP-Referer, X-Windowai-Title, X-Openrouter-Title, X-Title, X-Stainless-Lang, X-Stainless-Package-Version, X-Stainless-OS, X-Stainless-Arch, X-Stainless-Runtime, X-Stainless-Runtime-Version, X-Stainless-Retry-Count, Protection-Key',
  43. 'access-control-allow-methods': 'GET,OPTIONS,PATCH,DELETE,POST,PUT',
  44. 'access-control-allow-origin': '*',
  45. 'cache-control': 'public, max-age=0, must-revalidate',
  46. 'cf-cache-status': 'DYNAMIC',
  47. 'cf-ray': '8dbf2e7f880c24df-SJC',
  48. connection: 'keep-alive',
  49. 'content-encoding': 'br',
  50. 'content-security-policy': "default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://clerk.openrouter.ai https://cunning-heron-18.clerk.accounts.dev https://challenges.cloudflare.com https://checkout.stripe.com https://connect-js.stripe.com https://js.stripe.com https://maps.googleapis.com https://www.googletagmanager.com https://*.ingest.sentry.io; connect-src 'self' https://clerk.openrouter.ai https://cunning-heron-18.clerk.accounts.dev https://checkout.stripe.com https://api.stripe.com https://maps.googleapis.com *.google-analytics.com https://www.googletagmanager.com https://raw.githubusercontent.com wss://www.walletlink.org/rpc https://*.ingest.sentry.io; frame-src 'self' https://challenges.cloudflare.com https://checkout.stripe.com https://connect-js.stripe.com https://js.stripe.com https://hooks.stripe.com https://us5.datadoghq.com https://*.ingest.sentry.io; img-src 'self' data: blob: https://img.clerk.com https://*.stripe.com https://www.googletagmanager.com https://t0.gstatic.com; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' sha256-0hAheEzaMe6uXIKV4EehS9pu1am1lj/KnnzrOYqckXk=; upgrade-insecure-requests",
  51. 'content-type': 'application/json',
  52. date: 'Fri, 01 Nov 2024 22:04:38 GMT',
  53. server: 'cloudflare',
  54. 'strict-transport-security': 'max-age=63072000',
  55. 'transfer-encoding': 'chunked',
  56. vary: 'accept-encoding',
  57. 'x-matched-path': '/api/v1/chat/completions',
  58. 'x-vercel-cache': 'MISS',
  59. 'x-vercel-id': 'sfo1::7r8qz-1730498677690-53aabd927233'
  60. }
  61. },
  62. request: {},
  63. rawResponse: {
  64. headers: {
  65. 'access-control-allow-credentials': 'true',
  66. 'access-control-allow-headers': 'Authorization, User-Agent, X-Api-Key, X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, HTTP-Referer, X-Windowai-Title, X-Openrouter-Title, X-Title, X-Stainless-Lang, X-Stainless-Package-Version, X-Stainless-OS, X-Stainless-Arch, X-Stainless-Runtime, X-Stainless-Runtime-Version, X-Stainless-Retry-Count, Protection-Key',
  67. 'access-control-allow-methods': 'GET,OPTIONS,PATCH,DELETE,POST,PUT',
  68. 'access-control-allow-origin': '*',
  69. 'cache-control': 'public, max-age=0, must-revalidate',
  70. 'cf-cache-status': 'DYNAMIC',
  71. 'cf-ray': '8dbf2e7f880c24df-SJC',
  72. connection: 'keep-alive',
  73. 'content-encoding': 'br',
  74. 'content-security-policy': "default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://clerk.openrouter.ai https://cunning-heron-18.clerk.accounts.dev https://challenges.cloudflare.com https://checkout.stripe.com https://connect-js.stripe.com https://js.stripe.com https://maps.googleapis.com https://www.googletagmanager.com https://*.ingest.sentry.io; connect-src 'self' https://clerk.openrouter.ai https://cunning-heron-18.clerk.accounts.dev https://checkout.stripe.com https://api.stripe.com https://maps.googleapis.com *.google-analytics.com https://www.googletagmanager.com https://raw.githubusercontent.com wss://www.walletlink.org/rpc https://*.ingest.sentry.io; frame-src 'self' https://challenges.cloudflare.com https://checkout.stripe.com https://connect-js.stripe.com https://js.stripe.com https://hooks.stripe.com https://us5.datadoghq.com https://*.ingest.sentry.io; img-src 'self' data: blob: https://img.clerk.com https://*.stripe.com https://www.googletagmanager.com https://t0.gstatic.com; worker-src 'self' blob:; style-src 'self' 'unsafe-inline' sha256-0hAheEzaMe6uXIKV4EehS9pu1am1lj/KnnzrOYqckXk=; upgrade-insecure-requests",
  75. 'content-type': 'application/json',
  76. date: 'Fri, 01 Nov 2024 22:04:38 GMT',
  77. server: 'cloudflare',
  78. 'strict-transport-security': 'max-age=63072000',
  79. 'transfer-encoding': 'chunked',
  80. vary: 'accept-encoding',
  81. 'x-matched-path': '/api/v1/chat/completions',
  82. 'x-vercel-cache': 'MISS',
  83. 'x-vercel-id': 'sfo1::7r8qz-1730498677690-53aabd927233'
  84. }
  85. },
  86. logprobs: undefined
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement