Vertex AI includes a suite of models that work with code. Together these code models are referred to as the Vertex AI Codey APIs. The Vertex AI Codey APIs include the following:
-
The code generation API - Generates code based on a natural language description of the desired code. For example, it can generate a unit test for a function. The code generation API supports the
code-bison
model. For more information about thecode-bison
model, see Create prompts to generate code and Test code generation prompts. -
The code chat API - Can power a chatbot that assists with code-related questions. For example, you can use it for help debugging code. The code chat API supports the
codechat-bison
model. For more information about thecodechat-bison
model, see Create prompts to chat about code and Test code chat prompts. The code completion API - Provides code autocompletion suggestions as you write code. The API uses the context of the code you're writing to make its suggestions. The code completion API supports the
code-gecko
model. While thecode-gecko
model doesn't support streaming responses, you can use thecode-gecko
model to help improve the speed and accuracy of writing code. For more information about thecode-gecko
model, see Create prompts for code completion and Test code completion prompts.
To learn about using the Vertex AI SDK for Python to work with the code generation, code chat, and code completion models, see Use code models and the Vertex AI SDK.
Codey APIs best practices
When you use the Codey APIs, the following should be kept in mind:
We recommend that a human is involved when the Codey APIs are used. Outputs of solutions created with the Codey APIs should be comprehensively tested before the solutions are used by customers in production.
Code generated by the Codey APIs is not intended or designed to be a replacement for code development.
We recommend that you don't use the Codey APIs to implement solutions for sensitive industries, such as cybersecurity and hacking prevention.
Use cases for Codey APIs
You can use Codey APIs in many scenarios throughout the software development lifecycle. The following is a list of some use cases and the models that can help with them:
Use case | Codey models |
---|---|
Code completion | code-gecko |
Code generation | code-bison , codechat-bison |
Documentation in comments | codechat-bison |
Release notes generation | codechat-bison |
Unit test generation | code-bison , codechat-bison |
Code explanation | codechat-bison |
Code fixing | code-bison , codechat-bison |
Code optimization | code-bison , codechat-bison |
Code translation | code-bison , codechat-bison |
Codey APIs safety attributes
Content that the Codey APIs process is assessed against a list of safety attributes. These attributes include categories and topics that could be considered harmful or sensitive. For more information, see Responsible AI.
Supported coding languages
The Gemini 1.0 Pro model and the Codey APIs support a variety of coding languages. The following table lists each supported language.
Coding language | Extension | Gemini 1.0 Pro | code-bison |
codechat-bison |
code-gecko |
---|---|---|---|---|---|
C and its header files | .c , .h |
||||
C++ and its header files | .cc , .cpp , .h |
||||
C# | .cs |
||||
CSS | .css |
||||
Clojure | .clj , .cljs .cljc |
||||
Dart | .dart |
||||
Elixir | .ex |
||||
Erlang | .erl |
||||
Fortran | .f |
||||
Go | .go |
||||
GoogleSQL | .sql |
||||
Groovy | .groovy |
||||
Haskell | .hs |
||||
HTML | .html , htm |
||||
Java | .java |
||||
JavaScript | .js |
||||
JavaServer Pages | .jsp |
||||
Kotlin | .kt , .kts |
||||
Lean (proof assistant) | .lean |
||||
Lua | .lua |
||||
Objective-C | .m |
||||
OCaml | .ml |
||||
Perl | .pl |
||||
PHP | .php |
||||
Python | .py |
||||
R | .r |
||||
Ruby | .rb |
||||
Rust | .rs |
||||
Scala | .scala |
||||
Shell script | .sh |
||||
Solidity | .sol |
||||
Swift | .swift |
||||
TypeScript | .ts |
||||
XML | .xml |
||||
Verilog | .v |
||||
YAML | .yaml , .yml |
Supported code infrastructure interfaces
The Codey APIs support the following infrastructure as code interfaces:
What's next
You can create prototype prompts to test the Codey APIs by using Vertex AI Studio in the Google Cloud console or with the API. For more information, see Experiment with models in Vertex AI Studio. For examples of Codey APIs prompts you can run with the API and in Vertex AI Studio, see the following topics:
- Learn how to create code chat prompts.
- Learn how to create code completion prompts.
- Learn how to create code generation prompts
- Learn about streaming responses from a model.