agones.dev/agones@v1.53.0/examples/simple-genai-server/gameserver_npcchat.yaml (about)

     1  ---
     2  # Copyright 2024 Google LLC All Rights Reserved.
     3  #
     4  # Licensed under the Apache License, Version 2.0 (the "License");
     5  # you may not use this file except in compliance with the License.
     6  # You may obtain a copy of the License at
     7  #
     8  #     http://www.apache.org/licenses/LICENSE-2.0
     9  #
    10  # Unless required by applicable law or agreed to in writing, software
    11  # distributed under the License is distributed on an "AS IS" BASIS,
    12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  apiVersion: agones.dev/v1
    16  kind: GameServer
    17  metadata:
    18    name: gen-ai-server-npc
    19  spec:
    20    template:
    21      spec:
    22        containers:
    23          - name: simple-genai-game-server
    24            image: us-docker.pkg.dev/agones-images/examples/simple-genai-game-server:0.8
    25            # imagePullPolicy: Always  # add for development
    26            env:
    27              - name: GEN_AI_ENDPOINT
    28                # Use the service endpoint address when running in the same cluster as the inference server.
    29                value: "http://genai-api.genai.svc/genai/npc_chat"
    30                # To bypass the /genai routing layer:
    31                # value: "http://npc-chat-api.genai.svc"
    32              # GenAiContext is not passed to the npc-chat-api endpoint.
    33              - name: GEN_AI_NPC  # False by default. Use GEN_AI_NPC "true" when using the npc-chat-api as the GEN_AI_ENDPOINT.
    34                value: "true"
    35              - name: TO_ID  # Default is "1".
    36                value: "1"
    37              - name: SIM_ENDPOINT
    38                value: "http://genai-api.genai.svc/genai/chat"
    39                # To bypass the /genai routing layer:
    40                # value: "http://vertex-chat-api.genai.svc"
    41              - name: SIM_NPC
    42                value: "false"  # False by default. Use SIM_NPC "true" when using the npc-chat-api as the SIM_ENDPOINT.
    43              - name: CONCURRENT_PLAYERS
    44                value: "1"
    45              - name: PROMPT
    46                # In the autonomous case, prompt is the first message sent by the Sim. We need this to
    47                # prime the pump since neither chat LLMs is expecting to start.
    48                value: "Hey, do you have a sec?"
    49              - name: SIM_CONTEXT
    50                # Context for simulated player. This prompt was tested against Vertex chat-bison - if you switch
    51                # to a different model for the Sim, you will likely need to adjust the prompt.
    52                value: |
    53                  Please act like a person talking to another person named Joseph.
    54                  You are not a language model. You are not a virtual assistant.
    55  
    56                  Cymbal City, where you live, just had a major earthquake. You just approached a man named Joseph,
    57                  who you are familiar with but don't know well. You survived the earthquake, but you don't remember
    58                  your name. You are in shock, but you're curious what happened to Cymbal City during the earthquake,
    59                  you're curious who you are, and you're curious where you can find a hot dog.
    60  
    61                  Joseph looks like an aid worker, ask him questions.
    62                  Your questions should be short, you are in a hurry.
    63                  Ask one question about something you have not yet asked about.
    64  
    65                  Do not offer to help.
    66                  Do not try to be helpful, you are busy.
    67  
    68                  When you have all the information you need, say Bye!
    69              - name: STOP_PHRASE
    70                # If the Sim says something containing this string, allow the NPC to reply and then stop.
    71                # This should match a phrase in the SIM_CONTEXT.
    72                value: "Bye!"
    73              - name: NUM_CHATS
    74                value: "20"
    75            resources:
    76              requests:
    77                memory: 64Mi
    78                cpu: 20m
    79              limits:
    80                memory: 64Mi
    81                cpu: 20m
    82        # Schedule anywhere without a GPU
    83        affinity:
    84          nodeAffinity:
    85            requiredDuringSchedulingIgnoredDuringExecution:
    86              nodeSelectorTerms:
    87                - matchExpressions:
    88                    - key: cloud.google.com/gke-accelerator
    89                      operator: DoesNotExist