Skip to content

Commit

Permalink
add vertexai gemini support and refactor the log_row code (#124)
Browse files Browse the repository at this point in the history
* wip: add vertexai gemini support and refactor the log_row code

* add example for gemini and bug fix for anthropic messages

* ignore chat history for now

* update status for openai stream
  • Loading branch information
wenzhe-log10 authored Mar 25, 2024
1 parent e79579d commit a5e3de1
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 131 deletions.
23 changes: 23 additions & 0 deletions examples/logging/vertextai_gemini_chat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import vertexai
from vertexai.preview.generative_models import GenerationConfig, GenerativeModel

from log10.load import log10


log10(vertexai)

# change these to your own project and location
project_id = "YOUR_PROJECT_ID"
location = "YOUR_LOCATION"
vertexai.init(project=project_id, location=location)

model = GenerativeModel("gemini-1.0-pro")
chat = model.start_chat()

prompt = "What's the top 5 largest constellations you can find in North American during March?"
generation_config = GenerationConfig(
temperature=0.9,
max_output_tokens=128,
)
response = chat.send_message(prompt, generation_config=generation_config)
print(response.text)
Loading

0 comments on commit a5e3de1

Please sign in to comment.