Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create new http_kwargs, move api_kwars to namedtuple #10

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GoogleGenAI"
uuid = "903d41d1-eaca-47dd-943b-fee3930375ab"
authors = ["Tyler Thomas <[email protected]>"]
version = "0.1.0"
version = "0.2.0"

[deps]
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
Expand Down
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ outputs
```

```julia
response = generate_content(secret_key, model, prompt; max_output_tokens=10)
api_kwargs = (max_output_tokens=50,)
response = generate_content(secret_key, model, prompt; api_kwargs)
println(response.text)
```
outputs
```julia
"Hello! How can I assist you today?"
"Hello there, how may I assist you today?"
```

```julia
Expand All @@ -72,6 +73,7 @@ outputs
```julia
# Define the provider with your API key (placeholder here)
provider = GoogleProvider(api_key=ENV["GOOGLE_API_KEY"])
api_kwargs = (max_output_tokens=50,)
model_name = "gemini-pro"
conversation = [
Dict(:role => "user", :parts => [Dict(:text => "When was Julia 1.0 released?")])
Expand All @@ -82,7 +84,7 @@ push!(conversation, Dict(:role => "model", :parts => [Dict(:text => response.tex
println("Model: ", response.text)

push!(conversation, Dict(:role => "user", :parts => [Dict(:text => "Who created the language?")]))
response = generate_content(provider, model_name, conversation, max_output_tokens=100)
response = generate_content(provider, model_name, conversation; api_kwargs)
println("Model: ", response.text)
```
outputs
Expand Down Expand Up @@ -144,6 +146,10 @@ end
```
outputs
```julia
gemini-1.0-pro
gemini-1.0-pro-001
gemini-1.0-pro-latest
gemini-1.0-pro-vision-latest
gemini-pro
gemini-pro-vision
```
Expand All @@ -163,5 +169,6 @@ safety_settings = [
]
model = "gemini-pro"
prompt = "Hello"
response = generate_content(secret_key, model, prompt; safety_settings=safety_settings)
api_kwargs = (safety_settings=safety_settings,)
response = generate_content(secret_key, model, prompt; api_kwargs)
```
15 changes: 11 additions & 4 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ outputs
```

```julia
response = generate_content(secret_key, model, prompt; max_output_tokens=10)
api_kwargs = (max_output_tokens=50,)
response = generate_content(secret_key, model, prompt; api_kwargs)
println(response.text)
```
outputs
```julia
"Hello! How can I assist you today?"
"Hello there, how may I assist you today?"
```

```julia
Expand All @@ -66,6 +67,7 @@ outputs
```julia
# Define the provider with your API key (placeholder here)
provider = GoogleProvider(api_key=ENV["GOOGLE_API_KEY"])
api_kwargs = (max_output_tokens=50,)
model_name = "gemini-pro"
conversation = [
Dict(:role => "user", :parts => [Dict(:text => "When was Julia 1.0 released?")])
Expand All @@ -76,7 +78,7 @@ push!(conversation, Dict(:role => "model", :parts => [Dict(:text => response.tex
println("Model: ", response.text)

push!(conversation, Dict(:role => "user", :parts => [Dict(:text => "Who created the language?")]))
response = generate_content(provider, model_name, conversation, max_output_tokens=100)
response = generate_content(provider, model_name, conversation; api_kwargs)
println("Model: ", response.text)
```
outputs
Expand Down Expand Up @@ -138,6 +140,10 @@ end
```
outputs
```julia
gemini-1.0-pro
gemini-1.0-pro-001
gemini-1.0-pro-latest
gemini-1.0-pro-vision-latest
gemini-pro
gemini-pro-vision
```
Expand All @@ -157,5 +163,6 @@ safety_settings = [
]
model = "gemini-pro"
prompt = "Hello"
response = generate_content(secret_key, model, prompt; safety_settings=safety_settings)
api_kwargs = (safety_settings=safety_settings,)
response = generate_content(secret_key, model, prompt; api_kwargs)
```
Loading
Loading