Coba model Gemini 1.5, model multimodal terbaru di Vertex AI, dan lihat model yang dapat Anda bangun dengan jendela konteks hingga 2 juta token.Coba model Gemini 1.5, model multimodal terbaru di Vertex AI, dan lihat model yang dapat Anda bangun dengan jendela konteks hingga 2 juta token.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Membuat fungsi Python berdasarkan docstring-nya
Anda dapat membuat kueri model secara langsung dan menguji hasil yang tampak saat menggunakan
parameter value yang berbeda dengan konsol Cloud, atau dengan memanggil
Vertex AI API secara langsung.
fromcollectionsimportnamedtuplefrommathimportsqrt# A point has an x and a y coordinatePoint=namedtuple('Point', 'xy')# A triangle is defined by three pointsTriangle=namedtuple('Triangle', 'abc')defdistance(p,q):
"""Returnsthedistancebetweentheprovidedpairofpoints"""
returnsqrt((p.x-q.x)**2+(p.y-q.y)**2)defperimeter(triangle):
"""Returnstheperimeteroftheprovidedtriangle"""
returndistance(triangle.a,triangle.b)+distance(triangle.b,triangle.c)+distance(triangle.c,triangle.a)defarea(triangle):
"""ReturnstheareaoftheprovidedtriangleusingHeron'sformula"""
Tulis isi fungsi area, mengikuti docstring-nya.
Respons
fromcollectionsimportnamedtuplefrommathimportsqrt# A point has an x and a y coordinatePoint=namedtuple('Point', 'xy')# A triangle is defined by three pointsTriangle=namedtuple('Triangle', 'abc')defdistance(p,q):
"""Returnsthedistancebetweentheprovidedpairofpoints"""
returnsqrt((p.x-q.x)**2+(p.y-q.y)**2)defperimeter(triangle):
"""Returnstheperimeteroftheprovidedtriangle"""
returndistance(triangle.a,triangle.b)+distance(triangle.b,triangle.c)+distance(triangle.c,triangle.a)defarea(triangle):
"""ReturnstheareaoftheprovidedtriangleusingHeron'sformula"""
s=perimeter(triangle)/2returnsqrt(s*(s-distance(triangle.a,triangle.b))*(s-distance(triangle.b,triangle.c))*(s-distance(triangle.c,triangle.a)))
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2024-09-02 UTC."],[],[]]