Skip to content

Commit

Permalink
Create C3 Frameworks component and rename Typescript to TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
GregBrimble committed Sep 23, 2024
1 parent d11b947 commit 2ea7189
Show file tree
Hide file tree
Showing 53 changed files with 644 additions and 645 deletions.
10 changes: 4 additions & 6 deletions src/components/models/code/AutomaticSpeechRecognitionCode.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Code, Details } from "~/components";
type Props = z.infer<typeof props>;
const props = z.object({
name: z.string()
name: z.string(),
});
const { name } = props.parse(Astro.props);
Expand Down Expand Up @@ -36,7 +36,6 @@ export default {
} satisfies ExportedHandler<Env>;
`;
const curl = `
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/${name} \\
-X POST \\
Expand All @@ -46,11 +45,10 @@ curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run
---

<h2>Code Examples</h2>
<Details header="Workers - Typescript">
<Code code={worker} lang="ts" />
<Details header="Workers - TypeScript">
<Code code={worker} lang="ts" />
</Details>

<Details header="curl">
<Code code={curl} lang="sh" />
<Code code={curl} lang="sh" />
</Details>

10 changes: 4 additions & 6 deletions src/components/models/code/ImageClassificationCode.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Code, Details } from "~/components";
type Props = z.infer<typeof props>;
const props = z.object({
name: z.string()
name: z.string(),
});
const { name } = props.parse(Astro.props);
Expand Down Expand Up @@ -34,7 +34,6 @@ export default {
} satisfies ExportedHandler<Env>;
`;
const curl = `
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/${name} \\
-X POST \\
Expand All @@ -44,11 +43,10 @@ curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run
---

<h2>Code Examples</h2>
<Details header="Workers - Typescript">
<Code code={worker} lang="ts" />
<Details header="Workers - TypeScript">
<Code code={worker} lang="ts" />
</Details>

<Details header="curl">
<Code code={curl} lang="sh" />
<Code code={curl} lang="sh" />
</Details>

7 changes: 3 additions & 4 deletions src/components/models/code/ImageToTextCode.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Code, Details } from "~/components";
type Props = z.infer<typeof props>;
const props = z.object({
name: z.string()
name: z.string(),
});
const { name } = props.parse(Astro.props);
Expand Down Expand Up @@ -36,7 +36,6 @@ export default {
---

<h2>Code Examples</h2>
<Details header="Workers - Typescript">
<Code code={worker} lang="ts" />
<Details header="Workers - TypeScript">
<Code code={worker} lang="ts" />
</Details>

10 changes: 4 additions & 6 deletions src/components/models/code/ObjectDetectionCode.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Code, Details } from "~/components";
type Props = z.infer<typeof props>;
const props = z.object({
name: z.string()
name: z.string(),
});
const { name } = props.parse(Astro.props);
Expand Down Expand Up @@ -34,7 +34,6 @@ export default {
} satisfies ExportedHandler<Env>;
`;
const curl = `
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/${name} \\
-X POST \\
Expand All @@ -44,11 +43,10 @@ curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run
---

<h2>Code Examples</h2>
<Details header="Workers - Typescript">
<Code code={worker} lang="ts" />
<Details header="Workers - TypeScript">
<Code code={worker} lang="ts" />
</Details>

<Details header="curl">
<Code code={curl} lang="sh" />
<Code code={curl} lang="sh" />
</Details>

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Code, Details } from "~/components";
type Props = z.infer<typeof props>;
const props = z.object({
name: z.string()
name: z.string(),
});
const { name } = props.parse(Astro.props);
Expand Down Expand Up @@ -42,7 +42,6 @@ export default {
} satisfies ExportedHandler<Env>;
`;
const curl = `
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/${name} \\
-X POST \\
Expand All @@ -52,11 +51,10 @@ curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run
---

<h2>Code Examples</h2>
<Details header="Workers - Typescript">
<Code code={worker} lang="ts" />
<Details header="Workers - TypeScript">
<Code code={worker} lang="ts" />
</Details>

<Details header="curl">
<Code code={curl} lang="sh" />
<Code code={curl} lang="sh" />
</Details>

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Code, Details } from "~/components";
type Props = z.infer<typeof props>;
const props = z.object({
name: z.string()
name: z.string(),
});
const { name } = props.parse(Astro.props);
Expand Down Expand Up @@ -49,7 +49,6 @@ export default {
} satisfies ExportedHandler<Env>;
`;
const curl = `
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/${name} \\
-X POST \\
Expand All @@ -59,11 +58,10 @@ curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run
---

<h2>Code Examples</h2>
<Details header="Workers - Typescript">
<Code code={worker} lang="ts" />
<Details header="Workers - TypeScript">
<Code code={worker} lang="ts" />
</Details>

<Details header="curl">
<Code code={curl} lang="sh" />
<Code code={curl} lang="sh" />
</Details>

10 changes: 4 additions & 6 deletions src/components/models/code/SummarizationCode.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Code, Details } from "~/components";
type Props = z.infer<typeof props>;
const props = z.object({
name: z.string()
name: z.string(),
});
const { name } = props.parse(Astro.props);
Expand All @@ -26,7 +26,6 @@ export default {
} satisfies ExportedHandler<Env>;
`;
const curl = `
curl https://api.cloudflare.com/client/v4/accounts/{cf_account_id}/ai/run/${name} \\
-H "Authorization: Bearer {cf_api_token}" \\
Expand All @@ -38,11 +37,10 @@ curl https://api.cloudflare.com/client/v4/accounts/{cf_account_id}/ai/run/${name
---

<h2>Code Examples</h2>
<Details header="Workers - Typescript">
<Code code={worker} lang="ts" />
<Details header="Workers - TypeScript">
<Code code={worker} lang="ts" />
</Details>

<Details header="curl">
<Code code={curl} lang="sh" />
<Code code={curl} lang="sh" />
</Details>

14 changes: 6 additions & 8 deletions src/components/models/code/TextClassificationCode.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Code, Details } from "~/components";
type Props = z.infer<typeof props>;
const props = z.object({
name: z.string()
name: z.string(),
});
const { name } = props.parse(Astro.props);
Expand Down Expand Up @@ -40,8 +40,7 @@ def run(model, input):
output = run("${name}", { "text": "This pizza is great!" })
print(output)
`
`;
const curl = `
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/${name} \\
Expand All @@ -52,15 +51,14 @@ curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run
---

<h2>Code Examples</h2>
<Details header="Workers - Typescript">
<Code code={worker} lang="ts" />
<Details header="Workers - TypeScript">
<Code code={worker} lang="ts" />
</Details>

<Details header="Python">
<Code code={python} lang="py" />
<Code code={python} lang="py" />
</Details>

<Details header="curl">
<Code code={curl} lang="sh" />
<Code code={curl} lang="sh" />
</Details>

31 changes: 15 additions & 16 deletions src/components/models/code/TextEmbeddingCode.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Aside, Code, Details } from "~/components";
type Props = z.infer<typeof props>;
const props = z.object({
name: z.string()
name: z.string(),
});
const { name } = props.parse(Astro.props);
Expand Down Expand Up @@ -58,36 +58,35 @@ response = requests.post(
)
print(response.json())
`
`;
const curl = `
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/${name} \\
-X POST \\
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \\
-d '{ "text": ["This is a story about an orange cloud", "This is a story about a llama", "This is a story about a hugging emoji"] }'
`
`;
---

<h2>Code Examples</h2>
<Details header="Workers - Typescript">
<Code code={worker} lang="ts" />
<Details header="Workers - TypeScript">
<Code code={worker} lang="ts" />
</Details>

<Details header="Python">
<Code code={python} lang="py" />
<Code code={python} lang="py" />
</Details>

<Details header="curl">
<Code code={curl} lang="sh" />
<Code code={curl} lang="sh" />
</Details>

<Aside type="note" title="OpenAI compatible endpoints">
Workers AI also supports OpenAI compatible API endpoints for{" "}
<code>/v1/chat/completions</code> and <code>/v1/embeddings</code>. For
more details, refer to{" "}
<a href="/workers-ai/configuration/open-ai-compatibility/">
Configurations
</a>
.
</Aside>
Workers AI also supports OpenAI compatible API endpoints for{" "}
<code>/v1/chat/completions</code> and <code>/v1/embeddings</code>. For more
details, refer to{" "}
<a href="/workers-ai/configuration/open-ai-compatibility/">
Configurations
</a>
.
</Aside>
10 changes: 4 additions & 6 deletions src/components/models/code/TextToImageCode.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Code, Details } from "~/components";
type Props = z.infer<typeof props>;
const props = z.object({
name: z.string()
name: z.string(),
});
const { name } = props.parse(Astro.props);
Expand Down Expand Up @@ -36,7 +36,6 @@ export default {
} satisfies ExportedHandler<Env>;
`;
const curl = `
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/${name} \\
-X POST \\
Expand All @@ -46,11 +45,10 @@ curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run
---

<h2>Code Examples</h2>
<Details header="Workers - Typescript">
<Code code={worker} lang="ts" />
<Details header="Workers - TypeScript">
<Code code={worker} lang="ts" />
</Details>

<Details header="curl">
<Code code={curl} lang="sh" />
<Code code={curl} lang="sh" />
</Details>

14 changes: 6 additions & 8 deletions src/components/models/code/TranslationCode.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Code, Details } from "~/components";
type Props = z.infer<typeof props>;
const props = z.object({
name: z.string()
name: z.string(),
});
const { name } = props.parse(Astro.props);
Expand Down Expand Up @@ -49,8 +49,7 @@ output = run('${name}', {
})
print(output)
`
`;
const curl = `
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/${name} \\
Expand All @@ -61,15 +60,14 @@ curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run
---

<h2>Code Examples</h2>
<Details header="Workers - Typescript">
<Code code={worker} lang="ts" />
<Details header="Workers - TypeScript">
<Code code={worker} lang="ts" />
</Details>

<Details header="Python">
<Code code={python} lang="py" />
<Code code={python} lang="py" />
</Details>

<Details header="curl">
<Code code={curl} lang="sh" />
<Code code={curl} lang="sh" />
</Details>

6 changes: 3 additions & 3 deletions src/content/docs/ai-gateway/tutorials/deploy-aig-worker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ Create a Worker project in the command line:
file="c3-post-run-steps"
product="workers"
params={{
one: "Hello World example",
two: "Hello World Worker",
three: "JavaScript",
category: "hello-world",
type: "Hello World Worker",
lang: "JavaScript",
}}
/>

Expand Down
Loading

0 comments on commit 2ea7189

Please sign in to comment.