// src/components/docs/integrations/IntegrationsOpenAIPage.tsx
import Link from "@contractspec/lib.ui-link";
import { ChevronRight } from "lucide-react";
import { jsx, jsxs } from "react/jsx-runtime";
function IntegrationsOpenAIPage() {
  return /* @__PURE__ */ jsxs("div", {
    className: "space-y-8",
    children: [
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h1", {
            className: "text-4xl font-bold",
            children: "OpenAI"
          }),
          /* @__PURE__ */ jsx("p", {
            className: "text-muted-foreground",
            children: "Integrate OpenAI's powerful AI models for chat completion, embeddings, and speech-to-text. Build intelligent features with GPT-4, generate embeddings for semantic search, and transcribe audio with Whisper."
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Setup"
          }),
          /* @__PURE__ */ jsx("div", {
            className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded-lg border p-4 font-mono text-sm",
            children: /* @__PURE__ */ jsx("pre", {
              children: `# .env
OPENAI_API_KEY=sk-...
OPENAI_ORGANIZATION=org-...`
            })
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Chat completions"
          }),
          /* @__PURE__ */ jsx("div", {
            className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded-lg border p-4 font-mono text-sm",
            children: /* @__PURE__ */ jsx("pre", {
              children: `capabilityId: openai-chat
provider:
  type: openai
  operation: chatCompletion

inputs:
  messages:
    type: array
    items:
      type: object
      properties:
        role: string
        content: string
  model:
    type: string
    default: "gpt-4"
  temperature:
    type: number
    default: 0.7
    optional: true

outputs:
  content:
    type: string
  usage:
    type: object`
            })
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Embeddings"
          }),
          /* @__PURE__ */ jsx("div", {
            className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded-lg border p-4 font-mono text-sm",
            children: /* @__PURE__ */ jsx("pre", {
              children: `capabilityId: openai-embeddings
provider:
  type: openai
  operation: createEmbedding

inputs:
  text:
    type: string
  model:
    type: string
    default: "text-embedding-3-small"

outputs:
  embedding:
    type: array
    items:
      type: number`
            })
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Whisper (Speech-to-Text)"
          }),
          /* @__PURE__ */ jsx("div", {
            className: "bg-background/50 border-border text-muted-foreground overflow-x-auto rounded-lg border p-4 font-mono text-sm",
            children: /* @__PURE__ */ jsx("pre", {
              children: `capabilityId: openai-transcribe
provider:
  type: openai
  operation: transcribe

inputs:
  audioFile:
    type: file
  language:
    type: string
    optional: true

outputs:
  text:
    type: string
  language:
    type: string`
            })
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "space-y-4",
        children: [
          /* @__PURE__ */ jsx("h2", {
            className: "text-2xl font-bold",
            children: "Best practices"
          }),
          /* @__PURE__ */ jsxs("ul", {
            className: "text-muted-foreground list-inside list-disc space-y-2",
            children: [
              /* @__PURE__ */ jsx("li", {
                children: "Use streaming for real-time chat responses"
              }),
              /* @__PURE__ */ jsx("li", {
                children: "Cache embeddings to reduce API costs"
              }),
              /* @__PURE__ */ jsx("li", {
                children: "Implement rate limiting to avoid quota issues"
              }),
              /* @__PURE__ */ jsx("li", {
                children: "Store conversation history for context"
              }),
              /* @__PURE__ */ jsx("li", {
                children: "Monitor token usage and costs"
              })
            ]
          })
        ]
      }),
      /* @__PURE__ */ jsxs("div", {
        className: "flex items-center gap-4 pt-4",
        children: [
          /* @__PURE__ */ jsx(Link, {
            href: "/docs/integrations/google-calendar",
            className: "btn-ghost",
            children: "Previous: Google Calendar"
          }),
          /* @__PURE__ */ jsxs(Link, {
            href: "/docs/integrations/mistral",
            className: "btn-primary",
            children: [
              "Next: Mistral ",
              /* @__PURE__ */ jsx(ChevronRight, {
                size: 16
              })
            ]
          })
        ]
      })
    ]
  });
}
export {
  IntegrationsOpenAIPage
};
