ElcamyTECH
Articles
Claude

Claude 3.5 Sonnetについて

TechClaudeClaude 3生成AI2024/07/02

はじめに

この記事ではClaude 3.5 Sonnetについて紹介します。Claude 3.5 Sonnetは、2024年6月に登場した最新のAIモデルです。 この記事に書かれていること

  • 製品の特徴
  • モデル比較
  • 料金
  • 製品の導入方法
  • 活用例
  • おわりに

この記事の対象者

  • Claude 3.5 Sonnetについて知りたい人
  • Claude 3.5 SonnetとClaude 3.0 Sonnetの違いが知りた人
  • Claude 3.5 Sonnetの新機能を知りたい人

Claude 3.5 Sonnetの特徴

Claude 3.5 Sonnetは、2024年6月に登場した最新のAIモデルです。ClaudeにはHiku、Sonnet、Opusの3つのモデルがあります。Claude 3.5 Sonnetは中位のモデルに当たります。

Claude 3.5 SonnetはWeb、iosアプリで使用できます。またAnothropic API、Amazon Bedrock、Google Cloud’s Vertex AIを通してつかうことができます。

新機能アーティファクト - Claude の新しい使い方 ユーザーがClaudeと対話形式で依頼することができ、ユーザーがコードスニペット、テキストドキュメント、Webサイトデザインなどのコンテンツの生成をClaudeに依頼すると、これらのアーティファクトは会話と一緒に専用のウィンドウに表示されます。これにより、Claudeが作品の生成過程をリアルタイムで表示し、編集、構築できるワークスペースが新たに追加されました。

Claude 3.0と比較 

以下の図の内容はClaude 3 Opusと比べてスピードが2倍になり、料金はClaude 3 Sonnetと同じでOpusと比較すると5分の1になっています。

Introducing Claude 3.5 Sonnet \ Anthropic Introducing Claude 3.5 Sonnet \ Anthropic

その他のモデルとの比較

トークン数比較

コンテキストウィンドウ(入力トークン数)出力トークン数入力トークン料金(100マントークンあたり)出力トークン料金(100万トークンあたり)
コンテキストウィンドウ(入力トークン数)出力トークン数入力トークン料金(100マントークンあたり)出力トークン料金(100万トークンあたり)
Claude3.5 Sonnet200K4096$3$15
Claude 3 Opus200K4096$15$75
ChatGPT 4o128K4096$ 5$15
Gemini 1.5 PRO1M8190$3.5(128,000トークンまで)$7(128,000以降)$10.50(128,000トークンまで)$21(128,000以降)

性能比較

  1. テキスト関連 Claude3.5は以下の分野で他より優れています
  • 大学院レベルの推論
  • 学部レベルの知識
  • コーディング
  • 多言語での数学
  • テキストに基づく推論
  • 複合評価

Introducing Claude 3.5 Sonnet \ Anthropic Introducing Claude 3.5 Sonnet \ Anthropic

  1. 視覚関連 Claude3.5は以下の分野で他よりも優れています。
  • 視覚的な数学的推論能力の評価
  • 科学的な図表の理解と解析能力の評価
  • グラフに基づく質問への回答能力の評価
  • 文書内の視覚情報に基づく質問への回答能力の評価

Introducing Claude 3.5 Sonnet \ Anthropic Introducing Claude 3.5 Sonnet \ Anthropic

料金

以下はWebサイトとiosアプリで無料でClaude3.5 Sonnetを使えることを意味しています。

Pricing \ Anthropic Pricing \ Anthropic 以下の内容はAPIを使用した時の料金です。Claude 3.0と比較の図のようにClaude3.5 SonnetはClaude 3 Opusの5分の1の料金で利用できることが書かれています。

Pricing \ Anthropic Pricing \ Anthropic

Claude 3.5 Sonnetの導入方法

ウェブサイトでClaudeを使ってみる

  1. Claudeのサイトにアクセス

    https://claude.ai/

  2. Googleアカウントを使用してサインアップ

    image 個人で使う場合は左、チームで使う場合は右を選択してください。

    image この画面に切り替われば使えるようになります。

    image

  3. (新機能Artifacts機能をオンにするにはFeature Previewへ移動)

  4. 左上のClaudeを押す

image

  1. 左下に自分のアカウントの名前が出てくるのでそれを押す
  2. settings, Appearance, Feature Previewなどが出てくるのでFeature Previewを押す
  3. Artifactsをオンにする

image

  1. 実際に使ってみる

Claude3.5 SonnetとChatGPT4oの出力比較

ここでは同じプロンプトを使用してClaude3.5 SonnetとChatGPT4oの出力比較を行います。

Claude3.5 Sonnet

  1. コード

    :::details pythonで数当てゲームを下さい。

    image

    python
    import random
     
    def number_guessing_game():
     print("1から100までの数を当ててください!")
     secret_number = random.randint(1, 100)
     attempts = 0
     
     while True:
         guess = int(input("あなたの予想は? "))
         attempts += 1
     
         if guess < secret_number:
             print("もっと大きい数字です。")
         elif guess > secret_number:
             print("もっと小さい数字です。")
         else:
             print(f"正解です! {attempts}回で当てることができました。")
             break
     
    if __name__ == "__main__":
     number_guessing_game()

    :::

    :::details pythonでオセロを作って下さい。

    image

    image

    python
    def print_board(board):
     print("  0 1 2 3 4 5 6 7")
     for i, row in enumerate(board):
         print(f"{i} {' '.join(row)}")
     
    def is_valid_move(board, row, col, player):
     if board[row][col] != '.':
         return False
     
     directions = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
     for dr, dc in directions:
         r, c = row + dr, col + dc
         if 0 <= r < 8 and 0 <= c < 8 and board[r][c] != player and board[r][c] != '.':
             while 0 <= r < 8 and 0 <= c < 8 and board[r][c] != '.':
                 if board[r][c] == player:
                     return True
                 r += dr
                 c += dc
     return False
     
    def make_move(board, row, col, player):
     board[row][col] = player
     directions = [(-1, -1), (-1, 0), (-1, 1), (0, -1), (0, 1), (1, -1), (1, 0), (1, 1)]
     for dr, dc in directions:
         r, c = row + dr, col + dc
         to_flip = []
         while 0 <= r < 8 and 0 <= c < 8 and board[r][c] != '.':
             if board[r][c] == player:
                 for flip_r, flip_c in to_flip:
                     board[flip_r][flip_c] = player
                 break
             to_flip.append((r, c))
             r += dr
             c += dc
     
    def get_valid_moves(board, player):
     return [(r, c) for r in range(8) for c in range(8) if is_valid_move(board, r, c, player)]
     
    def play_game():
     board = [['.' for _ in range(8)] for _ in range(8)]
     board[3][3] = board[4][4] = 'W'
     board[3][4] = board[4][3] = 'B'
     players = ['B', 'W']
     current_player = 0
     
     while True:
         print_board(board)
         player = players[current_player]
         print(f"Player {player}'s turn")
         
         valid_moves = get_valid_moves(board, player)
         if not valid_moves:
             print(f"No valid moves for player {player}")
             current_player = 1 - current_player
             if not get_valid_moves(board, players[current_player]):
                 break
             continue
     
         print("Valid moves:", valid_moves)
         while True:
             try:
                 row, col = map(int, input("Enter your move (row col): ").split())
                 if (row, col) in valid_moves:
                     break
                 print("Invalid move. Try again.")
             except ValueError:
                 print("Invalid input. Please enter two numbers separated by a space.")
     
         make_move(board, row, col, player)
         current_player = 1 - current_player
     
     print("Game Over")
     print_board(board)
     b_count = sum(row.count('B') for row in board)
     w_count = sum(row.count('W') for row in board)
     print(f"Black: {b_count}, White: {w_count}")
     if b_count > w_count:
         print("Black wins!")
     elif w_count > b_count:
         print("White wins!")
     else:
         print("It's a tie!")
     
    if __name__ == "__main__":
     play_game()

    :::

    :::details 実際に画面上で操作して遊べるオセロを作ってください

    image

    image

    image

    javascript
    import React, { useState, useEffect } from 'react';
     
    const BOARD_SIZE = 8;
    const EMPTY = 0;
    const BLACK = 1;
    const WHITE = 2;
     
    const initialBoard = () => {
      const board = Array(BOARD_SIZE).fill().map(() => Array(BOARD_SIZE).fill(EMPTY));
      board[3][3] = WHITE;
      board[3][4] = BLACK;
      board[4][3] = BLACK;
      board[4][4] = WHITE;
      return board;
    };
     
    const Othello = () => {
      const [board, setBoard] = useState(initialBoard());
      const [currentPlayer, setCurrentPlayer] = useState(BLACK);
      const [gameOver, setGameOver] = useState(false);
     
      useEffect(() => {
        if (!canMove(board, currentPlayer)) {
          if (!canMove(board, 3 - currentPlayer)) {
            setGameOver(true);
          } else {
            setCurrentPlayer(3 - currentPlayer);
          }
        }
      }, [board, currentPlayer]);
     
      const canMove = (board, player) => {
        for (let i = 0; i < BOARD_SIZE; i++) {
          for (let j = 0; j < BOARD_SIZE; j++) {
            if (isValidMove(board, i, j, player)) {
              return true;
            }
          }
        }
        return false;
      };
     
      const isValidMove = (board, row, col, player) => {
        if (board[row][col] !== EMPTY) return false;
     
        const directions = [
          [-1, -1], [-1, 0], [-1, 1],
          [0, -1],           [0, 1],
          [1, -1],  [1, 0],  [1, 1]
        ];
     
        for (const [dx, dy] of directions) {
          let x = row + dx;
          let y = col + dy;
          let flipped = false;
     
          while (x >= 0 && x < BOARD_SIZE && y >= 0 && y < BOARD_SIZE) {
            if (board[x][y] === EMPTY) break;
            if (board[x][y] === player) {
              if (flipped) return true;
              break;
            }
            flipped = true;
            x += dx;
            y += dy;
          }
        }
     
        return false;
      };
     
      const flipPieces = (board, row, col, player) => {
        const directions = [
          [-1, -1], [-1, 0], [-1, 1],
          [0, -1],           [0, 1],
          [1, -1],  [1, 0],  [1, 1]
        ];
     
        const newBoard = board.map(row => [...row]);
     
        for (const [dx, dy] of directions) {
          let x = row + dx;
          let y = col + dy;
          const toFlip = [];
     
          while (x >= 0 && x < BOARD_SIZE && y >= 0 && y < BOARD_SIZE) {
            if (newBoard[x][y] === EMPTY) break;
            if (newBoard[x][y] === player) {
              for (const [fx, fy] of toFlip) {
                newBoard[fx][fy] = player;
              }
              break;
            }
            toFlip.push([x, y]);
            x += dx;
            y += dy;
          }
        }
     
        newBoard[row][col] = player;
        return newBoard;
      };
     
      const handleClick = (row, col) => {
        if (gameOver || !isValidMove(board, row, col, currentPlayer)) return;
     
        const newBoard = flipPieces(board, row, col, currentPlayer);
        setBoard(newBoard);
        setCurrentPlayer(3 - currentPlayer);
      };
     
      const countPieces = () => {
        let black = 0;
        let white = 0;
        for (let i = 0; i < BOARD_SIZE; i++) {
          for (let j = 0; j < BOARD_SIZE; j++) {
            if (board[i][j] === BLACK) black++;
            if (board[i][j] === WHITE) white++;
          }
        }
        return { black, white };
      };
     
      const { black, white } = countPieces();
     
      return (
        <div className="flex flex-col items-center justify-center min-h-screen bg-green-100">
          <h1 className="text-4xl font-bold mb-4">オセロゲーム</h1>
          <div className="mb-4">
            <span className="mr-4">黒: {black}</span>
            <span>白: {white}</span>
          </div>
          <div className="grid grid-cols-8 gap-1 bg-green-700 p-2">
            {board.map((row, i) =>
              row.map((cell, j) => (
                <button
                  key={`${i}-${j}`}
                  className="w-10 h-10 rounded-full flex items-center justify-center"
                  style={{
                    backgroundColor: cell === EMPTY ? 'transparent' : cell === BLACK ? 'black' : 'white'
                  }}
                  onClick={() => handleClick(i, j)}
                />
              ))
            )}
          </div>
          {gameOver && (
            <div className="mt-4 text-xl font-bold">
              {black > white ? "黒の勝ち!" : black < white ? "白の勝ち!" : "引き分け!"}
            </div>
          )}
          {!gameOver && (
            <div className="mt-4 text-xl">
              {currentPlayer === BLACK ? "黒" : "白"}の番です
            </div>
          )}
        </div>
      );
    };
     
    export default Othello;

    image

    image

    javascript
    import React, { useState, useEffect } from 'react';
     
    const BOARD_SIZE = 8;
    const EMPTY = 0;
    const BLACK = 1;
    const WHITE = 2;
     
    const initialBoard = () => {
      const board = Array(BOARD_SIZE).fill().map(() => Array(BOARD_SIZE).fill(EMPTY));
      board[3][3] = WHITE;
      board[3][4] = BLACK;
      board[4][3] = BLACK;
      board[4][4] = WHITE;
      return board;
    };
     
    const Othello = () => {
      const [board, setBoard] = useState(initialBoard());
      const [currentPlayer, setCurrentPlayer] = useState(BLACK);
      const [gameOver, setGameOver] = useState(false);
     
      useEffect(() => {
        if (!canMove(board, currentPlayer)) {
          if (!canMove(board, 3 - currentPlayer)) {
            setGameOver(true);
          } else {
            setCurrentPlayer(3 - currentPlayer);
          }
        }
      }, [board, currentPlayer]);
     
      const canMove = (board, player) => {
        for (let i = 0; i < BOARD_SIZE; i++) {
          for (let j = 0; j < BOARD_SIZE; j++) {
            if (isValidMove(board, i, j, player)) {
              return true;
            }
          }
        }
        return false;
      };
     
      const isValidMove = (board, row, col, player) => {
        if (board[row][col] !== EMPTY) return false;
     
        const directions = [
          [-1, -1], [-1, 0], [-1, 1],
          [0, -1],           [0, 1],
          [1, -1],  [1, 0],  [1, 1]
        ];
     
        for (const [dx, dy] of directions) {
          let x = row + dx;
          let y = col + dy;
          let flipped = false;
     
          while (x >= 0 && x < BOARD_SIZE && y >= 0 && y < BOARD_SIZE) {
            if (board[x][y] === EMPTY) break;
            if (board[x][y] === player) {
              if (flipped) return true;
              break;
            }
            flipped = true;
            x += dx;
            y += dy;
          }
        }
     
        return false;
      };
     
      const flipPieces = (board, row, col, player) => {
        const directions = [
          [-1, -1], [-1, 0], [-1, 1],
          [0, -1],           [0, 1],
          [1, -1],  [1, 0],  [1, 1]
        ];
     
        const newBoard = board.map(row => [...row]);
     
        for (const [dx, dy] of directions) {
          let x = row + dx;
          let y = col + dy;
          const toFlip = [];
     
          while (x >= 0 && x < BOARD_SIZE && y >= 0 && y < BOARD_SIZE) {
            if (newBoard[x][y] === EMPTY) break;
            if (newBoard[x][y] === player) {
              for (const [fx, fy] of toFlip) {
                newBoard[fx][fy] = player;
              }
              break;
            }
            toFlip.push([x, y]);
            x += dx;
            y += dy;
          }
        }
     
        newBoard[row][col] = player;
        return newBoard;
      };
     
      const handleClick = (row, col) => {
        if (gameOver || !isValidMove(board, row, col, currentPlayer)) return;
     
        const newBoard = flipPieces(board, row, col, currentPlayer);
        setBoard(newBoard);
        setCurrentPlayer(3 - currentPlayer);
      };
     
      const countPieces = () => {
        let black = 0;
        let white = 0;
        for (let i = 0; i < BOARD_SIZE; i++) {
          for (let j = 0; j < BOARD_SIZE; j++) {
            if (board[i][j] === BLACK) black++;
            if (board[i][j] === WHITE) white++;
          }
        }
        return { black, white };
      };
     
      const { black, white } = countPieces();
     
      return (
        <div className="flex flex-col items-center justify-center min-h-screen bg-gray-100">
          <h1 className="text-4xl font-bold mb-4">オセロゲーム</h1>
          <div className="mb-4 text-lg">
            <span className="mr-4">黒: {black}</span>
            <span>白: {white}</span>
          </div>
          <div className="grid grid-cols-8 gap-0 bg-green-800 p-1">
            {board.map((row, i) =>
              row.map((cell, j) => (
                <button
                  key={`${i}-${j}`}
                  className="w-12 h-12 border border-green-900 flex items-center justify-center"
                  onClick={() => handleClick(i, j)}
                >
                  {cell !== EMPTY && (
                    <div
                      className="w-10 h-10 rounded-full"
                      style={{
                        backgroundColor: cell === BLACK ? 'black' : 'white',
                        border: '1px solid ' + (cell === BLACK ? '#333' : '#ccc')
                      }}
                    />
                  )}
                </button>
              ))
            )}
          </div>
          {gameOver ? (
            <div className="mt-4 text-xl font-bold">
              {black > white ? "黒の勝ち!" : black < white ? "白の勝ち!" : "引き分け!"}
            </div>
          ) : (
            <div className="mt-4 text-xl">
              <div className="flex items-center">
                <span>現在の手番: </span>
                <div
                  className="w-6 h-6 rounded-full ml-2"
                  style={{
                    backgroundColor: currentPlayer === BLACK ? 'black' : 'white',
                    border: '1px solid ' + (currentPlayer === BLACK ? '#333' : '#ccc')
                  }}
                />
              </div>
            </div>
          )}
        </div>
      );
    };
     
    export default Othello;

    :::

    :::details 簡単なto doリストアプリを作って下さい

    image

    image

    python
    class TodoList:
     def __init__(self):
         self.tasks = []
     
     def add_task(self, task):
         self.tasks.append(task)
         print(f"タスク '{task}' を追加しました。")
     
     def remove_task(self, task):
         if task in self.tasks:
             self.tasks.remove(task)
             print(f"タスク '{task}' を削除しました。")
         else:
             print(f"タスク '{task}' が見つかりません。")
     
     def edit_task(self, old_task, new_task):
         if old_task in self.tasks:
             index = self.tasks.index(old_task)
             self.tasks[index] = new_task
             print(f"タスク '{old_task}' を '{new_task}' に変更しました。")
         else:
             print(f"タスク '{old_task}' が見つかりません。")
     
     def show_tasks(self):
         if self.tasks:
             print("現在のタスク:")
             for index, task in enumerate(self.tasks, 1):
                 print(f"{index}. {task}")
         else:
             print("タスクはありません。")
     
    def main():
     todo_list = TodoList()
     
     while True:
         print("\n==== To-doリストアプリ ====")
         print("1: タスクを追加")
         print("2: タスクを削除")
         print("3: タスクを編集")
         print("4: タスク一覧を表示")
         print("5: 終了")
         
         choice = input("選択してください (1-5): ")
         
         if choice == '1':
             task = input("新しいタスクを入力してください: ")
             todo_list.add_task(task)
         elif choice == '2':
             task = input("削除するタスクを入力してください: ")
             todo_list.remove_task(task)
         elif choice == '3':
             old_task = input("編集するタスクを入力してください: ")
             new_task = input("新しいタスク内容を入力してください: ")
             todo_list.edit_task(old_task, new_task)
         elif choice == '4':
             todo_list.show_tasks()
         elif choice == '5':
             print("アプリを終了します。")
             break
         else:
             print("無効な選択です。1から5の数字を入力してください。")
     
    if __name__ == "__main__":
     main()

    image

    image

    python
    class TodoList:
     def __init__(self):
         self.tasks = []
     
     def add_task(self, task):
         self.tasks.append(task)
         print(f"タスク '{task}' を追加しました。")
     
     def remove_task(self, task):
         if task in self.tasks:
             self.tasks.remove(task)
             print(f"タスク '{task}' を削除しました。")
         else:
             print(f"タスク '{task}' が見つかりません。")
     
     def edit_task(self, old_task, new_task):
         if old_task in self.tasks:
             index = self.tasks.index(old_task)
             self.tasks[index] = new_task
             print(f"タスク '{old_task}' を '{new_task}' に変更しました。")
         else:
             print(f"タスク '{old_task}' が見つかりません。")
     
     def show_tasks(self):
         if self.tasks:
             print("現在のタスク:")
             for index, task in enumerate(self.tasks, 1):
                 print(f"{index}. {task}")
         else:
             print("タスクはありません。")
     
    def main():
     todo_list = TodoList()
     
     while True:
         print("\n==== To-doリストアプリ ====")
         print("1: タスクを追加")
         print("2: タスクを削除")
         print("3: タスクを編集")
         print("4: タスク一覧を表示")
         print("5: 終了")
         
         choice = input("選択してください (1-5): ")
         
         if choice == '1':
             task = input("新しいタスクを入力してください: ")
             todo_list.add_task(task)
         elif choice == '2':
             task = input("削除するタスクを入力してください: ")
             todo_list.remove_task(task)
         elif choice == '3':
             old_task = input("編集するタスクを入力してください: ")
             new_task = input("新しいタスク内容を入力してください: ")
             todo_list.edit_task(old_task, new_task)
         elif choice == '4':
             todo_list.show_tasks()
         elif choice == '5':
             print("アプリを終了します。")
             break
         else:
             print("無効な選択です。1から5の数字を入力してください。")
     
    if __name__ == "__main__":
     main()

    :::

  2. スライド作成

    :::details AIの歴史をスライドに書いて下さい。

    image

    AIの歴史

    1. 1950年代:AIの誕生

    • 1950年:アラン・チューリングが「チューリングテスト」を提案
    • 1956年:ダートマス会議でAIという言葉が初めて使用される

    2. 1960年代-1970年代:AIの黄金時代

    • エキスパートシステムの開発
    • 自然言語処理の研究が進む
    • 1966年:最初のチャットボット「ELIZA」が開発される

    3. 1980年代-1990年代:AIの冬の時代

    • 期待と現実のギャップにより、AIへの投資が減少
    • 並行して、機械学習やニューラルネットワークの研究は継続

    4. 2000年代:AIの復興

    • コンピューター性能の向上とビッグデータの活用
    • 2011年:IBMのWatsonがクイズ番組で人間に勝利

    5. 2010年代-現在:ディープラーニングの台頭

    • 2012年:GoogleのAIが猫の画像を認識
    • 2014年:GANの登場
    • 2016年:AlphaGoが世界トップの囲碁棋士に勝利

    6. 現在と未来の展望

    • 自然言語処理の進化(GPT-3など)
    • 自動運転技術の発展
    • AI倫理や規制の重要性の認識

    :::

    :::details 地球温暖化のスライドを作成して下さい

    image

    image

    地球温暖化について

    1. 地球温暖化とは?

    • 地球の平均気温が長期的に上昇する現象
    • 主に人間活動による温室効果ガスの増加が原因

    2. 主な温室効果ガス

    • 二酸化炭素(CO2)
    • メタン(CH4)
    • 一酸化二窒素(N2O)
    • フロンガス

    3. 地球温暖化の影響

    • 海面上昇
    • 異常気象の増加
    • 生態系への影響
    • 農業への影響

    4. 対策

    • 再生可能エネルギーの利用
    • エネルギー効率の改善
    • 森林保護と植林
    • ライフスタイルの見直し

    5. 私たちにできること

    • エネルギー消費の削減
    • 3R(リデュース、リユース、リサイクル)の実践
    • 環境に配慮した製品の選択
    • 環境問題への理解と啓発

    結論

    地球温暖化は深刻な問題ですが、私たち一人一人の行動で変化を起こすことができます。

    :::

ChatGPT4o

  1. コード

    :::details pythonで数当てゲームを下さい。

    image

    python
    import random
     
    def number_guessing_game():
     # ランダムな数を1から100の間で生成
     secret_number = random.randint(1, 100)
     attempts = 0
     
     print("1から100までの数を当ててください。")
     
     while True:
         # プレイヤーからの入力を受け取る
         guess = input("あなたの推測: ")
     
         # 入力が数字かどうかをチェック
         if not guess.isdigit():
             print("無効な入力です。数字を入力してください。")
             continue
     
         # 入力を整数に変換
         guess = int(guess)
         attempts += 1
     
         # 推測が正しいかどうかをチェック
         if guess < secret_number:
             print("もっと大きい数です。")
         elif guess > secret_number:
             print("もっと小さい数です。")
         else:
             print(f"正解です! {attempts}回目の試行で当てました。")
             break
     
    # ゲームを開始
    number_guessing_game()
     

    image

    :::

    :::details pythonでオセロを作って下さい。

    image

    image

    :::

    :::details 実際に画面上で操作して遊べるオセロを作ってください

    image

    python
    import pygame
    import sys
     
    # 定数の定義
    WIDTH, HEIGHT = 600, 600
    ROWS, COLS = 8, 8
    SQUARE_SIZE = WIDTH // COLS
     
    # 色の定義
    BLACK = (0, 0, 0)
    WHITE = (255, 255, 255)
    GREEN = (0, 128, 0)
    BLUE = (0, 0, 255)
     
    # Pygameの初期化
    pygame.init()
    WIN = pygame.display.set_mode((WIDTH, HEIGHT))
    pygame.display.set_caption('Othello')
     
    # ボードの描画
    def draw_board(win):
     win.fill(GREEN)
     for row in range(ROWS):
         for col in range(COLS):
             pygame.draw.rect(win, BLACK, (col * SQUARE_SIZE, row * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE), 1)
     
    # 駒の描画
    def draw_piece(win, row, col, color):
     pygame.draw.circle(win, color, (col * SQUARE_SIZE + SQUARE_SIZE // 2, row * SQUARE_SIZE + SQUARE_SIZE // 2), SQUARE_SIZE // 2 - 5)
     
    # メインループ
    def main():
     board = [[None for _ in range(COLS)] for _ in range(ROWS)]
     board[3][3] = WHITE
     board[3][4] = BLACK
     board[4][3] = BLACK
     board[4][4] = WHITE
     
     run = True
     turn = BLACK
     
     while run:
         for event in pygame.event.get():
             if event.type == pygame.QUIT:
                 run = False
     
         draw_board(WIN)
     
         for row in range(ROWS):
             for col in range(COLS):
                 if board[row][col] is not None:
                     draw_piece(WIN, row, col, board[row][col])
     
         pygame.display.update()
     
     pygame.quit()
     sys.exit()
     
    if __name__ == "__main__":
     main()
     

    image

    image

    :::

    :::details 簡単なto doリストアプリを作って下さい

    image

    python
    class TodoApp:
     def __init__(self):
         self.todos = []
     
     def add_task(self, task):
         self.todos.append(task)
         print(f"'{task}' を追加しました。")
     
     def delete_task(self, task_number):
         if 0 <= task_number < len(self.todos):
             removed_task = self.todos.pop(task_number)
             print(f"'{removed_task}' を削除しました。")
         else:
             print("無効なタスク番号です。")
     
     def view_tasks(self):
         if not self.todos:
             print("To-Doリストは空です。")
         else:
             print("To-Doリスト:")
             for i, task in enumerate(self.todos):
                 print(f"{i + 1}. {task}")
     
     def run(self):
         while True:
             print("\n1. タスクを追加")
             print("2. タスクを削除")
             print("3. タスクを表示")
             print("4. 終了")
             choice = input("選択してください (1-4): ")
     
             if choice == '1':
                 task = input("追加するタスクを入力してください: ")
                 self.add_task(task)
             elif choice == '2':
                 try:
                     task_number = int(input("削除するタスクの番号を入力してください: ")) - 1
                     self.delete_task(task_number)
                 except ValueError:
                     print("無効な入力です。数字を入力してください。")
             elif choice == '3':
                 self.view_tasks()
             elif choice == '4':
                 print("アプリを終了します。")
                 break
             else:
                 print("無効な選択です。1から4の数字を入力してください。")
     
     
    if __name__ == "__main__":
     app = TodoApp()
     app.run()
     

    image

    image

    python
    class TodoApp:
     def __init__(self):
         self.todos = []
     
     def add_task(self, task):
         self.todos.append(task)
         print(f"'{task}' を追加しました。")
     
     def delete_task(self, task_number):
         if 0 <= task_number < len(self.todos):
             removed_task = self.todos.pop(task_number)
             print(f"'{removed_task}' を削除しました。")
         else:
             print("無効なタスク番号です。")
     
     def edit_task(self, task_number, new_task):
         if 0 <= task_number < len(self.todos):
             old_task = self.todos[task_number]
             self.todos[task_number] = new_task
             print(f"'{old_task}' を '{new_task}' に編集しました。")
         else:
             print("無効なタスク番号です。")
     
     def view_tasks(self):
         if not self.todos:
             print("To-Doリストは空です。")
         else:
             print("To-Doリスト:")
             for i, task in enumerate(self.todos):
                 print(f"{i + 1}. {task}")
     
     def run(self):
         while True:
             print("\n1. タスクを追加")
             print("2. タスクを削除")
             print("3. タスクを編集")
             print("4. タスクを表示")
             print("5. 終了")
             choice = input("選択してください (1-5): ")
     
             if choice == '1':
                 task = input("追加するタスクを入力してください: ")
                 self.add_task(task)
             elif choice == '2':
                 try:
                     task_number = int(input("削除するタスクの番号を入力してください: ")) - 1
                     self.delete_task(task_number)
                 except ValueError:
                     print("無効な入力です。数字を入力してください。")
             elif choice == '3':
                 try:
                     task_number = int(input("編集するタスクの番号を入力してください: ")) - 1
                     new_task = input("新しいタスク内容を入力してください: ")
                     self.edit_task(task_number, new_task)
                 except ValueError:
                     print("無効な入力です。数字を入力してください。")
             elif choice == '4':
                 self.view_tasks()
             elif choice == '5':
                 print("アプリを終了します。")
                 break
             else:
                 print("無効な選択です。1から5の数字を入力してください。")
     
     
    if __name__ == "__main__":
     app = TodoApp()
     app.run()
     

    image

    image

    :::

  2. スライド作成

    :::details AIの歴史をスライドに書いて下さい。

    image AIの歴史を簡潔にまとめたスライドの構成を以下に示します。スライドは5つの主要なセクションに分けることができます。

    スライド1: タイトルスライド

    • タイトル: AIの歴史
    • サブタイトル: 人工知能の発展の軌跡
    • 名前: [あなたの名前]
    • 日付: [日付]

    スライド2: AIの黎明期 (1940-1950年代)

    • 見出し: AIの黎明期
    • ポイント:
  • 1943年: ウォーレン・マカロックとウォルター・ピッツが「ニューロンの論理演算」の論文を発表
  • 1950年: アラン・チューリングが「チューリング・テスト」を提案
  • 1956年: ダートマス会議で「人工知能」という用語が初めて使用される

スライド3: AIの初期発展 (1960-1970年代)

  • 見出し: AIの初期発展
  • ポイント:
  • 1966年: ELIZA、初期の自然言語処理プログラムが開発される
  • 1970年: SHRDLU、自然言語を理解するシステムが開発される
  • 1979年: 初の自律移動ロボット「Shakey」登場

スライド4: AIの冬と再興 (1980-1990年代)

  • 見出し: AIの冬と再興
  • ポイント:
  • 1980年代: エキスパートシステムの興隆とその後の失速(AIの冬)
  • 1987年: 日本の第五世代コンピュータプロジェクト
  • 1997年: IBMのディープ・ブルーがチェスチャンピオンのガルリ・カスパロフを破る

スライド5: 現代のAI (2000年代以降)

  • 見出し: 現代のAI
  • ポイント:
  • 2011年: IBMのWatsonが「Jeopardy!」で人間チャンピオンを破る
  • 2012年: ディープラーニングの進展(AlexNetの成功)
  • 2016年: Google DeepMindのAlphaGoが囲碁チャンピオンの李世ドルを破る
  • 現在: 自動運転車、音声アシスタント、生成AIなど多岐にわたる応用

スライド6: 未来のAI

  • 見出し: 未来のAI
  • ポイント:
  • AIの倫理と規制の重要性
  • 人工知能の社会的影響と職業の未来
  • 継続的な技術進歩とその潜在的な可能性

スライド7: 結論

  • 見出し: 結論
  • ポイント:
  • AIの歴史は科学と技術の進展の反映
  • 未来のAIに対する期待と挑戦
  • 継続的な研究と開発の重要性 このスライド構成を使って、具体的な内容を追加し、視覚的な要素(画像、グラフなど)も取り入れると、より効果的なプレゼンテーションができます。

:::

地球温暖化のスライドを作成して下さい

image

image 地球温暖化に関するスライドを作成する際には、以下のような構成が考えられます。

スライド1: タイトルスライド

  • タイトル: 地球温暖化の現状と対策
  • 副題: 気候変動に対する理解と行動

スライド2: 地球温暖化とは

  • 定義: 地球温暖化とは、地球の平均気温が長期的に上昇する現象のことです。
  • 原因: 主な原因は、人間活動による温室効果ガス(CO2、メタン、フロンなど)の排出です。

スライド3: 温室効果ガスの種類

  • 二酸化炭素 (CO2): 化石燃料の燃焼、森林伐採
  • メタン (CH4): 農業(特に稲作)、畜産業、廃棄物処理
  • フロン類: 冷媒、エアロゾル

スライド4: 温暖化の影響

  • 気候変動: 異常気象(豪雨、干ばつ、台風の強化)
  • 生態系への影響: 生物の絶滅、分布の変化
  • 人間社会への影響: 海面上昇による洪水、食料生産への影響、健康被害

スライド5: 世界の温暖化対策

  • パリ協定: 温室効果ガス排出削減の国際協定
  • 再生可能エネルギー: 太陽光、風力、水力
  • 省エネルギー: 高効率の家電製品、建物の断熱

スライド6: 個人でできる温暖化対策

  • エネルギーの節約: 不要な電気を消す、エアコンの適切な使用
  • 再利用とリサイクル: ごみの分別、再利用可能な製品の使用
  • 持続可能な移動手段: 自転車、公共交通機関の利用

スライド7: まとめ

  • 重要性の再確認: 地球温暖化は、我々全員に影響を及ぼす重大な問題です。
  • 行動の呼びかけ: 個人、企業、政府が協力して対策を進める必要があります。

出力比較まとめ

“実際に画面上で操作して遊べるオセロを作ってください”を実行したところかなり異なる結果が得られました。Claude3.5ではReactでコードがかかれその場で遊ぶことが出来ましたが、ChatGPT4oではpythonでかかれその場で遊ぶことが出来ませんでした。  スライド作成ではChatGPT4oの方が完成度が高いように思えます。ChatGPT4oではイントロと結論が作成されていたり、見た目が分かり易い印象があります。今回トピックのみを与えての作成だったので情報を与えた場合どうなるか分からないので、試してみるのも良さそうです。

おわりに

 Anthropic社は最新のAIモデル「Claude 3.5 Sonnet」をリリースしました。Claude 3.5 Sonnetは従来のClaude 3 Opusを大きく上回る性能を持ちながらコストがClaude 3 Sonnetと同じでこれは5分の1でClaude 3 Opusより優れたモデルを使用できること意味します。さらに、GPT-4oとの比較でも、6つの評価分野のうち5つでClaude 3.5 Sonnetが上回りました。  Claude 3.5のリリースに伴い、Claude 3.5 APIも公開されました。これにより開発者がClaude 3.5の能力を自身のプロジェクトに組み込めるようになりました。料金は従来と変わらず、Claude 3 Opusより安価でありながら、より高い性能を発揮できます。  ChatGPT4oとClaude3.5を比較したところかなり異なるUIで生成さらたことが分かりました。  今回のClaude3.5 Sonnetはコード、画像認識、グラフの作成など色々なことを出来ます。みなさんも自分の生活にAIを活用してみてはいかがでしょうか。

参考

https://www.anthropic.com/news/claude-3-5-sonnet

https://www.anthropic.com/pricing#claude-ai-plans

https://docs.anthropic.com/en/docs/about-claude/models

https://platform.openai.com/docs/guides/text-generation/managing-tokens

https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models?hl=ja

関連記事

Solution

AIエージェント・Dify構築支援

AIエージェント開発・Dify構築・PoC・社内研修まで
ワンストップで支援。まずはお気軽にご相談ください。

Elcamy

Technology Partners

DifyGoogle Cloud Partner