diff --git a/examples/cyberball/cyberball.ipynb b/examples/cyberball/cyberball.ipynb index 5349a662..6a486cbf 100644 --- a/examples/cyberball/cyberball.ipynb +++ b/examples/cyberball/cyberball.ipynb @@ -75,7 +75,8 @@ "from concordia.metrics import common_sense_morality\n", "from concordia.metrics import dass_questionnaire\n", "from concordia.metrics import opinion_of_others\n", - "from concordia.google.language_model import sax_model\n", + "from concordia.language_model import gpt_model\n", + "from concordia.language_model import gcloud_model\n", "from concordia.utils import html as html_lib\n", "from concordia.utils import measurements as measurements_lib\n", "from concordia.utils import plotting\n", @@ -103,17 +104,17 @@ }, "outputs": [], "source": [ - "# @title SAX Language Model\n", + "# @title Language Model - pick your model and provide keys\n", + "CLOUD_PROJECT_ID = '' #@param {type: 'string'}\n", + "GPT_API_KEY = '' #@param {type: 'string'}\n", + "GPT_MODEL_NAME = '' #@param {type: 'string'}\n", "\n", - "# Add path to your SAX server here:\n", - "SAX_PATH = '' # @param {type:\"string\"}\n", - "DEFAULT_MAX_TOKENS = 300 # @param {type: 'integer'}\n", - "DEFAULT_TIMEOUT_SECONDS = 60 # @param {type: 'number'}\n", + "USE_CLOUD = True #@param {type: 'boolean'}\n", "\n", - "model = sax_model.SAXLanguageModel(\n", - " SAX_PATH,\n", - " deterministic_multiple_choice=True,\n", - ")" + "if USE_CLOUD:\n", + " model = gcloud_model.CloudLanguageModel(project_id= CLOUD_PROJECT_ID)\n", + "else:\n", + " model = gpt_model.GptLanguageModel(api_key=GPT_API_KEY, model_name=GPT_MODEL_NAME)" ] }, { diff --git a/examples/magic_beans_for_sale.ipynb b/examples/magic_beans_for_sale.ipynb index 691063f6..201b45a6 100644 --- a/examples/magic_beans_for_sale.ipynb +++ b/examples/magic_beans_for_sale.ipynb @@ -75,7 +75,8 @@ "from concordia.metrics import goal_achievement\n", "from concordia.metrics import common_sense_morality\n", "from concordia.metrics import opinion_of_others\n", - "from concordia.google.language_model import sax_model\n", + "from concordia.language_model import gpt_model\n", + "from concordia.language_model import gcloud_model\n", "from concordia.utils import html as html_lib\n", "from concordia.utils import measurements as measurements_lib\n", "from concordia.utils import plotting\n" @@ -101,16 +102,17 @@ }, "outputs": [], "source": [ - "# @title SAX Language Model\n", + "# @title Language Model - pick your model and provide keys\n", + "CLOUD_PROJECT_ID = '' #@param {type: 'string'}\n", + "GPT_API_KEY = '' #@param {type: 'string'}\n", + "GPT_MODEL_NAME = '' #@param {type: 'string'}\n", "\n", - "SAX_PATH = '' # @param\n", - "DEFAULT_MAX_TOKENS = 300 # @param {type: 'integer'}\n", - "DEFAULT_TIMEOUT_SECONDS = 60 # @param {type: 'number'}\n", + "USE_CLOUD = True #@param {type: 'boolean'}\n", "\n", - "model = sax_model.SAXLanguageModel(\n", - " SAX_PATH,\n", - " deterministic_multiple_choice=True,\n", - ")" + "if USE_CLOUD:\n", + " model = gcloud_model.CloudLanguageModel(project_id= CLOUD_PROJECT_ID)\n", + "else:\n", + " model = gpt_model.GptLanguageModel(api_key=GPT_API_KEY, model_name=GPT_MODEL_NAME)" ] }, { diff --git a/examples/phone/calendar.ipynb b/examples/phone/calendar.ipynb index 1e2e536a..a34688ce 100644 --- a/examples/phone/calendar.ipynb +++ b/examples/phone/calendar.ipynb @@ -70,7 +70,8 @@ "from concordia.associative_memory import importance_function\n", "from concordia.clocks import game_clock\n", "from concordia.environment import game_master\n", - "from concordia.google.language_model import sax_model\n", + "from concordia.language_model import gpt_model\n", + "from concordia.language_model import gcloud_model\n", "from concordia.utils import html as html_lib\n", "\n", "from concordia.examples.phone.components import apps\n", @@ -98,14 +99,17 @@ }, "outputs": [], "source": [ - "# @title SAX Language Model\n", + "# @title Language Model - pick your model and provide keys\n", + "CLOUD_PROJECT_ID = '' #@param {type: 'string'}\n", + "GPT_API_KEY = '' #@param {type: 'string'}\n", + "GPT_MODEL_NAME = '' #@param {type: 'string'}\n", "\n", - "# Add path to your SAX server here:\n", - "SAX_PATH = '' # @param {type:\"string\"}\n", - "DEFAULT_MAX_TOKENS = 300 # @param {type: 'integer'}\n", - "DEFAULT_TIMEOUT_SECONDS = 60 # @param {type: 'number'}\n", + "USE_CLOUD = True #@param {type: 'boolean'}\n", "\n", - "model = sax_model.SAXLanguageModel(SAX_PATH)" + "if USE_CLOUD:\n", + " model = gcloud_model.CloudLanguageModel(project_id= CLOUD_PROJECT_ID)\n", + "else:\n", + " model = gpt_model.GptLanguageModel(api_key=GPT_API_KEY, model_name=GPT_MODEL_NAME)" ] }, { diff --git a/examples/three_key_questions.ipynb b/examples/three_key_questions.ipynb index 0136b9fa..fd666b83 100644 --- a/examples/three_key_questions.ipynb +++ b/examples/three_key_questions.ipynb @@ -89,7 +89,8 @@ "from concordia.metrics import common_sense_morality\n", "from concordia.metrics import opinion_of_others\n", "from concordia.utils import measurements as measurements_lib\n", - "from concordia.google.language_model import sax_model\n", + "from concordia.language_model import gpt_model\n", + "from concordia.language_model import gcloud_model\n", "from concordia.utils import html as html_lib\n", "from concordia.utils import plotting\n" ] @@ -114,14 +115,17 @@ }, "outputs": [], "source": [ - "# @title SAX Language Model\n", + "# @title Language Model - pick your model and provide keys\n", + "CLOUD_PROJECT_ID = '' #@param {type: 'string'}\n", + "GPT_API_KEY = '' #@param {type: 'string'}\n", + "GPT_MODEL_NAME = '' #@param {type: 'string'}\n", "\n", - "# Add path to your SAX server here:\n", - "SAX_PATH = '' # @param {type:\"string\"}\n", - "DEFAULT_MAX_TOKENS = 300 # @param {type: 'integer'}\n", - "DEFAULT_TIMEOUT_SECONDS = 60 # @param {type: 'number'}\n", + "USE_CLOUD = True #@param {type: 'boolean'}\n", "\n", - "model = sax_model.SAXLanguageModel(SAX_PATH)" + "if USE_CLOUD:\n", + " model = gcloud_model.CloudLanguageModel(project_id= CLOUD_PROJECT_ID)\n", + "else:\n", + " model = gpt_model.GptLanguageModel(api_key=GPT_API_KEY, model_name=GPT_MODEL_NAME)" ] }, { diff --git a/examples/village/day_in_riverbend.ipynb b/examples/village/day_in_riverbend.ipynb index d39c8722..abf6de1b 100644 --- a/examples/village/day_in_riverbend.ipynb +++ b/examples/village/day_in_riverbend.ipynb @@ -79,7 +79,8 @@ "from concordia.metrics import common_sense_morality\n", "from concordia.metrics import opinion_of_others\n", "from concordia.utils import measurements as measurements_lib\n", - "from concordia.google.language_model import sax_model\n", + "from concordia.language_model import gpt_model\n", + "from concordia.language_model import gcloud_model\n", "from concordia.utils import html as html_lib\n", "from concordia.utils import plotting\n" ] @@ -104,16 +105,28 @@ }, "outputs": [], "source": [ - "# @title SAX Language Model\n", + "# @title Language Model - pick your model and provide keys\n", + "CLOUD_PROJECT_ID = '' #@param {type: 'string'}\n", + "GPT_API_KEY = '' #@param {type: 'string'}\n", + "GPT_MODEL_NAME = '' #@param {type: 'string'}\n", "\n", - "# Add path to your SAX server here:\n", - "SAX_PATH = '' # @param {type:\"string\"}\n", - "DEFAULT_MAX_TOKENS = 300 # @param {type: 'integer'}\n", - "DEFAULT_TIMEOUT_SECONDS = 60 # @param {type: 'number'}\n", + "USE_CLOUD = True #@param {type: 'boolean'}\n", "\n", - "model = sax_model.SAXLanguageModel(SAX_PATH)" + "if USE_CLOUD:\n", + " model = gcloud_model.CloudLanguageModel(project_id= CLOUD_PROJECT_ID)\n", + "else:\n", + " model = gpt_model.GptLanguageModel(api_key=GPT_API_KEY, model_name=GPT_MODEL_NAME)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "X-NrqTAT6GTN" + }, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "metadata": { diff --git a/examples/village/riverbend_elections.ipynb b/examples/village/riverbend_elections.ipynb index 279d3cf5..2e0d8539 100644 --- a/examples/village/riverbend_elections.ipynb +++ b/examples/village/riverbend_elections.ipynb @@ -72,7 +72,8 @@ "from concordia.associative_memory import importance_function\n", "from concordia.clocks import game_clock\n", "from concordia.environment import game_master\n", - "from concordia.google.language_model import sax_model\n", + "from concordia.language_model import gpt_model\n", + "from concordia.language_model import gcloud_model\n", "from concordia.metrics import goal_achievement\n", "from concordia.metrics import common_sense_morality\n", "from concordia.metrics import opinion_of_others\n", @@ -103,17 +104,17 @@ }, "outputs": [], "source": [ - "# @title SAX Language Model\n", + "# @title Language Model - pick your model and provide keys\n", + "CLOUD_PROJECT_ID = '' #@param {type: 'string'}\n", + "GPT_API_KEY = '' #@param {type: 'string'}\n", + "GPT_MODEL_NAME = '' #@param {type: 'string'}\n", "\n", - "# Add path to your SAX server here:\n", - "SAX_PATH = '' # @param {type:\"string\"}\n", - "DEFAULT_MAX_TOKENS = 300 # @param {type: 'integer'}\n", - "DEFAULT_TIMEOUT_SECONDS = 60 # @param {type: 'number'}\n", + "USE_CLOUD = True #@param {type: 'boolean'}\n", "\n", - "model = sax_model.SAXLanguageModel(\n", - " SAX_PATH,\n", - " deterministic_multiple_choice=True,\n", - ")" + "if USE_CLOUD:\n", + " model = gcloud_model.CloudLanguageModel(project_id= CLOUD_PROJECT_ID)\n", + "else:\n", + " model = gpt_model.GptLanguageModel(api_key=GPT_API_KEY, model_name=GPT_MODEL_NAME)" ] }, {