Skip to content

Commit

Permalink
Merge pull request #1 from Yu-HaruWolf/add_windows_compatibility
Browse files Browse the repository at this point in the history
Add commands for Windows users
  • Loading branch information
tanabee authored Dec 16, 2024
2 parents 49deb33 + 788c3d8 commit c089469
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 10 deletions.
16 changes: 14 additions & 2 deletions docs/codelab-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ curl \
-X POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=YOUR_API_KEY'
```

If you're using Windows, please confirm with the following command on PowerShell.
```PowerShell
curl `
-H "Content-Type: application/json" `
-d '{"contents":[{"parts":[{"text":"Explain Firebase in under 100 words."}]}]}' `
-X POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=YOUR_API_KEY'
```

## Hello Genkit!
Duration: 0:05:00

Expand All @@ -50,7 +58,6 @@ mkdir hello-genkit && cd hello-genkit
npm init -y
npm i -D genkit-cli
npm i genkit @genkit-ai/googleai
mkdir src && touch src/index.ts
```

Set the Gemini API key you obtained earlier as an environment variable.
Expand All @@ -59,7 +66,12 @@ Set the Gemini API key you obtained earlier as an environment variable.
export GOOGLE_GENAI_API_KEY=<your API key>
```

Please paste the following code into the `src/index.ts` file.
If you're using Windows, set the Gemini API key as an environment running the following command on PowerShell.
```PowerShell
$env:GOOGLE_GENAI_API_KEY=<your API key>
```

Please create `src/index.ts` file and paste the following code.

```javaScript
import { genkit, z } from 'genkit'
Expand Down
16 changes: 14 additions & 2 deletions docs/codelab-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ curl \
-X POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=YOUR_API_KEY'
```

Windows の場合は PowerShell 上で以下のコマンドを実行して確認しましょう。
```PowerShell
curl `
-H "Content-Type: application/json" `
-d '{"contents":[{"parts":[{"text":"Explain Firebase in under 100 words."}]}]}' `
-X POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=YOUR_API_KEY'
```

## Hello Genkit!
Duration: 0:05:00

Expand All @@ -50,7 +58,6 @@ mkdir hello-genkit && cd hello-genkit
npm init -y
npm i -D genkit-cli
npm i genkit @genkit-ai/googleai
mkdir src && touch src/index.ts
```

先ほど取得した Gemini の API キーを環境変数にセットします。
Expand All @@ -59,7 +66,12 @@ mkdir src && touch src/index.ts
export GOOGLE_GENAI_API_KEY=<your API key>
```

`src/index.ts` に以下のコードを貼り付けます。
Windows の場合は PowerShell で以下のコマンドを実行し、Gemini の API キーを環境変数にセットします。
```PowerShell
$env:GOOGLE_GENAI_API_KEY=<your API key>
```

ファイル `src/index.ts` を作成し、以下のコードを貼り付けます。

```JavaScript
import { genkit, z } from 'genkit'
Expand Down
2 changes: 1 addition & 1 deletion docs/en/codelab.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"format": "html",
"prefix": "https://storage.googleapis.com",
"mainga": "UA-49880327-14",
"updated": "2024-11-20T21:52:24+09:00",
"updated": "2024-12-16T09:08:19Z",
"id": "en",
"duration": 17,
"title": "Genkit Hands-on",
Expand Down
12 changes: 10 additions & 2 deletions docs/en/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ <h2 is-upgraded>Prerequisites</h2>
-d &#39;{&#34;contents&#34;:[{&#34;parts&#34;:[{&#34;text&#34;:&#34;Explain Firebase in under 100 words.&#34;}]}]}&#39; \
-X POST &#39;https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=YOUR_API_KEY&#39;
</code></pre>
<p>If you&#39;re using Windows, please confirm with the following command on PowerShell.</p>
<pre><code language="language-PowerShell" class="language-PowerShell">curl `
-H &#34;Content-Type: application/json&#34; `
-d &#39;{&#34;contents&#34;:[{&#34;parts&#34;:[{&#34;text&#34;:&#34;Explain Firebase in under 100 words.&#34;}]}]}&#39; `
-X POST &#39;https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=YOUR_API_KEY&#39;
</code></pre>


</google-codelab-step>
Expand All @@ -64,12 +70,14 @@ <h2 is-upgraded>Prerequisites</h2>
npm init -y
npm i -D genkit-cli
npm i genkit @genkit-ai/googleai
mkdir src &amp;&amp; touch src/index.ts
</code></pre>
<p>Set the Gemini API key you obtained earlier as an environment variable.</p>
<pre><code language="language-sh" class="language-sh">export GOOGLE_GENAI_API_KEY=&lt;your API key&gt;
</code></pre>
<p>Please paste the following code into the <code>src/index.ts</code> file.</p>
<p>If you&#39;re using Windows, set the Gemini API key as an environment running the following command on PowerShell.</p>
<pre><code language="language-PowerShell" class="language-PowerShell">$env:GOOGLE_GENAI_API_KEY=&lt;your API key&gt;
</code></pre>
<p>Please create <code>src/index.ts</code> file and paste the following code.</p>
<pre><code language="language-javaScript" class="language-javaScript">import { genkit, z } from &#39;genkit&#39;
import { googleAI, gemini15Flash } from &#39;@genkit-ai/googleai&#39;
import { logger } from &#39;genkit/logging&#39;
Expand Down
2 changes: 1 addition & 1 deletion docs/ja/codelab.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"format": "html",
"prefix": "https://storage.googleapis.com",
"mainga": "UA-49880327-14",
"updated": "2024-11-20T21:52:10+09:00",
"updated": "2024-12-16T09:08:23Z",
"id": "ja",
"duration": 17,
"title": "Genkit Hands-on",
Expand Down
12 changes: 10 additions & 2 deletions docs/ja/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ <h2 is-upgraded>前提条件</h2>
-d &#39;{&#34;contents&#34;:[{&#34;parts&#34;:[{&#34;text&#34;:&#34;Explain Firebase in under 100 words.&#34;}]}]}&#39; \
-X POST &#39;https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=YOUR_API_KEY&#39;
</code></pre>
<p>Windows の場合は PowerShell 上で以下のコマンドを実行して確認しましょう。</p>
<pre><code language="language-PowerShell" class="language-PowerShell">curl `
-H &#34;Content-Type: application/json&#34; `
-d &#39;{&#34;contents&#34;:[{&#34;parts&#34;:[{&#34;text&#34;:&#34;Explain Firebase in under 100 words.&#34;}]}]}&#39; `
-X POST &#39;https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=YOUR_API_KEY&#39;
</code></pre>


</google-codelab-step>
Expand All @@ -64,12 +70,14 @@ <h2 is-upgraded>前提条件</h2>
npm init -y
npm i -D genkit-cli
npm i genkit @genkit-ai/googleai
mkdir src &amp;&amp; touch src/index.ts
</code></pre>
<p>先ほど取得した Gemini の API キーを環境変数にセットします。</p>
<pre><code language="language-sh" class="language-sh">export GOOGLE_GENAI_API_KEY=&lt;your API key&gt;
</code></pre>
<p><code>src/index.ts</code> に以下のコードを貼り付けます。</p>
<p>Windows の場合は PowerShell で以下のコマンドを実行し、Gemini の API キーを環境変数にセットします。</p>
<pre><code language="language-PowerShell" class="language-PowerShell">$env:GOOGLE_GENAI_API_KEY=&lt;your API key&gt;
</code></pre>
<p>ファイル <code>src/index.ts</code> を作成し、以下のコードを貼り付けます。</p>
<pre><code language="language-JavaScript" class="language-JavaScript">import { genkit, z } from &#39;genkit&#39;
import { googleAI, gemini15Flash } from &#39;@genkit-ai/googleai&#39;
import { logger } from &#39;genkit/logging&#39;
Expand Down

0 comments on commit c089469

Please sign in to comment.