code-bison

A LLM model fine-tuned to generate code based on a natural language description of the desired code. For example, it can generate a unit test for a function.

Input

Prompt:

Press Ctrl + Enter to submit

Output

Submit a prompt for a response.

Notes

Note

This model has special pricing. Check out here

Overview

Even as PaLM 2 is more capable, it’s also faster and more efficient than previous models — and it comes in a variety of sizes, which makes it easy to deploy for a wide range of use cases. PaLM 2 is available in four sizes, from smallest to largest: Gecko, Otter, Bison, and Unicorn. Gecko is so lightweight that it can work on mobile devices and is fast enough for great interactive applications on-device, even when offline. This versatility means PaLM 2 can be fine-tuned to support entire classes of products in more ways, to help more people.

Gecko: The smallest and lowest cost model for simple tasks

Code-biston

code-bison is the name of the model that supports code generation. It's a foundation model that generates code based on a natural language description. The type of content that code-bison can create includes functions, web pages, and unit tests. code-bison is supported by the code generation Codey API. The Codey APIs are in the PaLM API family.

Use cases

Some commonly used cases for code generation are:

  • Unit tests: Use the prompt to request a unit test for a function.
Prompt: Write a test case for the 'divide' function that handles division by zero
Response:
def divide(x, y):
"""Divides `x` by `y`. Args: x: The numerator. y: The denominator. Returns: The quotient of `x` divided by `y`. Raises: ZeroDivisionError: If `y` is zero. """
if y == 0:
raise ZeroDivisionError("Division by zero")
return x / y
  • Write a function: Pass a problem to the model to get a function that solves that problem.
prompt:I need a function that removes all vowels from a given input string
Response:
def remove_vowels(string):
## Removes all vowels from a given string.
new_string = for character in string: if character not in "aeiouAEIOU": new_string += character
return new_string
  • Create a class: Use a prompt to describe the purpose of a class and have code that defines the class returned.
Prompt: Please create a Python class called 'BankAccount' with methods for deposit, withdrawal, and balance inquiry

Response:
class BankAccount:
def __init__(self, account_number, balance):
self.account_number = account_number
self.balance = balance
def deposit(self, amount):
self.balance += amount
def withdraw(self, amount):
if self.balance < amount: raise ValueError("Insufficient funds") else: self.balance -=amount def get_balance(self): return self.balance 

Disclaimer

Please be advised that this model utilizes wrapped Artificial Intelligence (AI) provided by GCP (the "Vendor"). These AI models may collect, process, and store data as part of their operations. By using our website and accessing these AI models, you hereby consent to the data practices of the Vendor. We do not have control over the data collection, processing, and storage practices of the Vendor. Therefore, we cannot be held responsible or liable for any data handling practices, data loss, or breaches that may occur. It is your responsibility to review the privacy policies and terms of service of the Vendor to understand their data practices. You can access the Vendor's privacy policy and terms of service at https://cloud.google.com/privacy.

We disclaim all liability with respect to the actions or omissions of the Vendor, and we encourage you to exercise caution and to ensure that you are comfortable with these practices before utilizing the AI models hosted on our site.

  • ID
  • Model Type ID
    Text To Text
  • Input Type
    text
  • Output Type
    text
  • Description
    A LLM model fine-tuned to generate code based on a natural language description of the desired code. For example, it can generate a unit test for a function.
  • Last Updated
    Oct 17, 2024
  • Privacy
    PUBLIC
  • Use Case
  • License
  • Share
  • Badge
    code-bison