Skip to content

Commit

Permalink
Merge pull request #14 from tylerjthomas9/dev
Browse files Browse the repository at this point in the history
remove gemini-pro-vision-1.0
  • Loading branch information
tylerjthomas9 authored Sep 21, 2024
2 parents 576e503 + 4e62074 commit 47b857c
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 30 deletions.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Pkg> add https://github.com/tylerjthomas9/GoogleGenAI.jl/

## Quick Start

Create a [secret API key in Google AI Studio](https://makersuite.google.com/)

1. Create a [secret API key in Google AI Studio](https://aistudio.google.com).
2. Set the `GOOGLE_API_KEY` environment variable.

### Generate Content

Expand Down Expand Up @@ -57,7 +57,7 @@ outputs
using GoogleGenAI

secret_key = ENV["GOOGLE_API_KEY"]
model = "gemini-pro-vision"
model = "gemini-1.5-flash-latest"
prompt = "What is this image?"
image_path = "test/example.jpg"
response = generate_content(secret_key, model, prompt, image_path)
Expand Down Expand Up @@ -146,14 +146,21 @@ end
```
outputs
```julia
gemini-1.0-pro-latest
gemini-1.0-pro
gemini-pro
gemini-1.0-pro-001
gemini-1.0-pro-latest
gemini-1.0-pro-vision-latest
gemini-1.5-flash-latest
gemini-1.5-pro-latest
gemini-pro
gemini-pro-vision
gemini-1.5-pro-001
gemini-1.5-pro
gemini-1.5-pro-exp-0801
gemini-1.5-pro-exp-0827
gemini-1.5-flash-latest
gemini-1.5-flash-001
gemini-1.5-flash-001-tuning
gemini-1.5-flash
gemini-1.5-flash-exp-0827
gemini-1.5-flash-8b-exp-0827
```

### Safety Settings
Expand Down
51 changes: 30 additions & 21 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ Pkg> add https://github.com/tylerjthomas9/GoogleGenAI.jl/

## Quick Start

Create a [secret API key in Google AI Studio](https://makersuite.google.com/)

1. Create a [secret API key in Google AI Studio](https://aistudio.google.com).
2. Set the `GOOGLE_API_KEY` environment variable.

### Generate Content

```julia
using GoogleGenAI

secret_key = ENV["GOOGLE_API_KEY"]
model = "gemini-pro"
model = "gemini-1.5-flash-latest"
prompt = "Hello"
response = generate_content(secret_key, model, prompt)
println(response.text)
```
outputs
```julia
"Hello there! How may I assist you today? Feel free to ask me any questions you may have or give me a command. I'm here to help! 😊"
"Hello! 👋 How can I help you today? 😊"
```

```julia
Expand All @@ -44,14 +44,14 @@ println(response.text)
```
outputs
```julia
"Hello there, how may I assist you today?"
"Hello! 👋 How can I help you today? 😊"
```

```julia
using GoogleGenAI

secret_key = ENV["GOOGLE_API_KEY"]
model = "gemini-pro-vision"
model = "gemini-1.5-flash-latest"
prompt = "What is this image?"
image_path = "test/example.jpg"
response = generate_content(secret_key, model, prompt, image_path)
Expand All @@ -65,40 +65,40 @@ outputs
### Multi-turn conversations

```julia
# Define the provider with your API key (placeholder here)
using GoogleGenAI

provider = GoogleProvider(api_key=ENV["GOOGLE_API_KEY"])
api_kwargs = (max_output_tokens=50,)
model_name = "gemini-pro"
model = "gemini-1.5-flash-latest"
conversation = [
Dict(:role => "user", :parts => [Dict(:text => "When was Julia 1.0 released?")])
]

response = generate_content(provider, model_name, conversation)
response = generate_content(provider, model, conversation)
push!(conversation, Dict(:role => "model", :parts => [Dict(:text => response.text)]))
println("Model: ", response.text)

push!(conversation, Dict(:role => "user", :parts => [Dict(:text => "Who created the language?")]))
response = generate_content(provider, model_name, conversation; api_kwargs)
response = generate_content(provider, model, conversation; api_kwargs)
println("Model: ", response.text)
```
outputs
```julia
"Model: August 8, 2018"

"Model: Jeff Bezanson, Alan Edelman, Viral B. Shah, Stefan Karpinski, and Keno Fischer
"Model: Julia 1.0 was released on **August 8, 2018**."

Julia Computing, Inc. is the company that provides commercial support for Julia."
"Model: Julia was created by a team of developers at MIT, led by **Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and Alan Edelman**."
```

### Count Tokens
```julia
using GoogleGenAI
n_tokens = count_tokens(ENV["GOOGLE_API_KEY"], "gemini-pro", "Hello")
model = "gemini-1.5-flash-latest"
n_tokens = count_tokens(ENV["GOOGLE_API_KEY"], model, "The Julia programming language")
println(n_tokens)
```
outputs
```julia
1
4
```

### Create Embeddings
Expand Down Expand Up @@ -140,12 +140,21 @@ end
```
outputs
```julia
gemini-1.0-pro
gemini-1.0-pro-001
gemini-1.0-pro-latest
gemini-1.0-pro-vision-latest
gemini-1.0-pro
gemini-pro
gemini-pro-vision
gemini-1.0-pro-001
gemini-1.5-pro-latest
gemini-1.5-pro-001
gemini-1.5-pro
gemini-1.5-pro-exp-0801
gemini-1.5-pro-exp-0827
gemini-1.5-flash-latest
gemini-1.5-flash-001
gemini-1.5-flash-001-tuning
gemini-1.5-flash
gemini-1.5-flash-exp-0827
gemini-1.5-flash-8b-exp-0827
```

### Safety Settings
Expand All @@ -161,7 +170,7 @@ safety_settings = [
Dict("category" => "HARM_CATEGORY_HARASSMENT", "threshold" => "BLOCK_MEDIUM_AND_ABOVE"),
Dict("category" => "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold" => "BLOCK_LOW_AND_ABOVE")
]
model = "gemini-pro"
model = "gemini-1.5-flash-latest"
prompt = "Hello"
api_kwargs = (safety_settings=safety_settings,)
response = generate_content(secret_key, model, prompt; api_kwargs)
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if haskey(ENV, "GOOGLE_API_KEY")
# Generate text from text+image
response = generate_content(
secret_key,
"gemini-pro-vision",
"gemini-1.5-flash-latest",
"What is this picture?",
"example.jpg";
api_kwargs,
Expand Down

0 comments on commit 47b857c

Please sign in to comment.