Skip to content

Commit

Permalink
Adding Complete and Summarize for Vertex AI, along with a number of … (
Browse files Browse the repository at this point in the history
#406)

* Adding Complete and Summarize for Vertex AI, along with a number of enhancements

* linter

* linter

* linter

---------

Co-authored-by: Andrei Bondarev <[email protected]>
Co-authored-by: Andrei Bondarev <[email protected]>
  • Loading branch information
3 people authored Dec 7, 2023
1 parent 98c9caa commit 5b5a43b
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 86 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ ELASTICSEARCH_URL=https://[username]:[password]@localhost:9200
ELASTICSEARCH_CA_FINGERPRINT=
GOOGLE_PALM_API_KEY=
GOOGLE_VERTEX_AI_PROJECT_ID=
# Automagical name which is picked up by Google Cloud Ruby auth module. If set, takes auth token from that key file.
GOOGLE_CLOUD_CREDENTIALS=
HUGGING_FACE_API_KEY=
LLAMACPP_MODEL_PATH=
LLAMACPP_N_THREADS=
Expand Down
197 changes: 118 additions & 79 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,55 @@ GEM
remote: https://rubygems.org/
specs:
Ascii85 (1.0.3)
actionpack (7.0.8)
actionview (= 7.0.8)
activesupport (= 7.0.8)
rack (~> 2.0, >= 2.2.4)
actionpack (7.1.2)
actionview (= 7.1.2)
activesupport (= 7.1.2)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actionview (7.0.8)
activesupport (= 7.0.8)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actionview (7.1.2)
activesupport (= 7.1.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activesupport (7.0.8)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activesupport (7.1.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.4)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
afm (0.2.2)
ai21 (0.2.1)
anthropic (0.1.0)
faraday (>= 1)
faraday-multipart (>= 1)
ast (2.4.2)
aws-eventstream (1.2.0)
aws-partitions (1.848.0)
aws-sdk-bedrockruntime (1.1.0)
aws-sdk-core (~> 3, >= 3.184.0)
aws-eventstream (1.3.0)
aws-partitions (1.862.0)
aws-sdk-bedrockruntime (1.4.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sigv4 (~> 1.1)
aws-sdk-core (3.186.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-sdk-core (3.190.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sigv4 (1.6.1)
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
baran (0.1.10)
base64 (0.2.0)
bigdecimal (3.1.4)
builder (3.2.4)
byebug (11.1.3)
childprocess (4.1.0)
Expand All @@ -74,6 +84,7 @@ GEM
faraday (>= 2.0.1, < 3.0)
colorize (0.8.1)
concurrent-ruby (1.2.2)
connection_pool (2.4.1)
crass (1.0.6)
declarative (0.0.20)
diff-lcs (1.5.0)
Expand All @@ -84,10 +95,12 @@ GEM
dotenv-rails (2.7.6)
dotenv (= 2.7.6)
railties (>= 3.2)
dry-configurable (1.0.1)
drb (2.2.0)
ruby2_keywords
dry-configurable (1.1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-core (1.0.0)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
dry-inflector (1.0.0)
Expand All @@ -100,7 +113,7 @@ GEM
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-schema (1.13.1)
dry-schema (1.13.3)
concurrent-ruby (~> 1.0)
dry-configurable (~> 1.0, >= 1.0.1)
dry-core (~> 1.0, < 2)
Expand Down Expand Up @@ -139,13 +152,15 @@ GEM
treetop (>= 1.2.0)
erubi (1.12.0)
event_stream_parser (0.3.0)
faraday (2.7.10)
faraday (2.7.12)
base64
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (3.0.2)
faraday-retry (1.0.3)
faraday-retry (2.2.0)
faraday (~> 2.0)
google-apis-aiplatform_v1 (0.7.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.2)
Expand All @@ -169,7 +184,8 @@ GEM
graphlient (0.7.0)
faraday (~> 2.0)
graphql-client
graphql (2.1.1)
graphql (2.1.6)
racc (~> 1.4)
hashery (2.1.2)
hashie (5.0.0)
hnswlib (0.8.1)
Expand All @@ -182,35 +198,40 @@ GEM
i18n (1.14.1)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
io-console (0.6.0)
irb (1.9.1)
rdoc
reline (>= 0.3.8)
jmespath (1.6.2)
json (2.6.3)
json (2.7.0)
json-schema (4.0.0)
addressable (>= 2.8)
jwt (2.7.1)
language_server-protocol (3.17.0.3)
lint_roller (1.0.0)
llama_cpp (0.9.4)
loofah (2.21.1)
lint_roller (1.1.0)
llama_cpp (0.9.5)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
nokogiri (>= 1.12.0)
matrix (0.4.2)
method_source (1.0.0)
milvus (0.9.2)
faraday (>= 2.0.1, < 3)
mini_mime (1.1.2)
mini_portile2 (2.8.2)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.20.0)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.3.0)
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
mutex_m (0.2.0)
nokogiri (1.15.5)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.14.3-arm64-darwin)
nokogiri (1.15.5-arm64-darwin)
racc (~> 1.4)
nokogiri (1.14.3-x86_64-darwin)
nokogiri (1.15.5-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.14.3-x86_64-linux)
nokogiri (1.15.5-x86_64-linux)
racc (~> 1.4)
open-weather-ruby-client (0.4.0)
activesupport
Expand All @@ -219,16 +240,17 @@ GEM
hashie
os (1.1.4)
parallel (1.23.0)
parser (3.2.2.1)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
pdf-reader (1.4.1)
Ascii85 (~> 1.0.0)
afm (~> 0.2.1)
hashery (~> 2.0)
ruby-rc4
ttfunk
pg (1.5.3)
pgvector (0.2.1)
pg (1.5.4)
pgvector (0.2.2)
pinecone (0.1.71)
dry-struct (~> 1.6.0)
dry-validation (~> 1.10.0)
Expand All @@ -242,30 +264,44 @@ GEM
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
public_suffix (5.0.1)
psych (5.1.1.1)
stringio
public_suffix (5.0.4)
qdrant-ruby (0.9.4)
faraday (>= 2.0.1, < 3)
racc (1.6.2)
rack (2.2.7)
racc (1.7.3)
rack (3.0.8)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
railties (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
method_source
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.1.2)
actionpack (= 7.1.2)
activesupport (= 7.1.2)
irb
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.0.6)
rake (13.1.0)
rb_sys (0.9.83)
rdiscount (2.2.7)
regexp_parser (2.8.0)
rdiscount (2.2.7.1)
rdoc (6.6.0)
psych (>= 4.0.0)
regexp_parser (2.8.2)
reline (0.4.1)
io-console (~> 0.5)
replicate-ruby (0.2.3)
addressable
faraday (>= 1.0)
Expand All @@ -276,7 +312,7 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.5)
rexml (3.2.6)
roo (2.10.0)
nokogiri (~> 1)
rubyzip (>= 1.3.0, < 3.0.0)
Expand All @@ -289,23 +325,24 @@ GEM
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (1.50.2)
rspec-support (3.12.1)
rubocop (1.57.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.0.0)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.0, < 2.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.28.1)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-performance (1.16.0)
rubocop-performance (1.19.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
ruby-next (0.15.3)
Expand All @@ -331,20 +368,22 @@ GEM
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
standard (1.28.2)
standard (1.32.0)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.50.2)
rubocop (~> 1.57.2)
standard-custom (~> 1.0.0)
standard-performance (~> 1.0.1)
standard-custom (1.0.0)
lint_roller (~> 1.0)
standard-performance (1.0.1)
standard-performance (~> 1.2)
standard-custom (1.0.2)
lint_roller (~> 1.0)
rubocop-performance (~> 1.16.0)
rubocop (~> 1.50)
standard-performance (1.2.1)
lint_roller (~> 1.1)
rubocop-performance (~> 1.19.1)
standardrb (1.0.1)
standard
thor (1.2.1)
stringio (3.1.0)
thor (1.3.0)
tiktoken_ruby (0.0.6)
rb_sys (~> 0.9.68)
tiktoken_ruby (0.0.6-arm64-darwin)
Expand All @@ -359,18 +398,18 @@ GEM
concurrent-ruby (~> 1.0)
uber (0.1.0)
unicode (0.4.4.4)
unicode-display_width (2.4.2)
unparser (0.6.8)
unicode-display_width (2.5.0)
unparser (0.6.10)
diff-lcs (~> 1.3)
parser (>= 3.2.0)
parser (>= 3.2.2.4)
weaviate-ruby (0.8.9)
faraday (>= 2.0.1, < 3.0)
graphlient (~> 0.7.0)
webrick (1.8.1)
wikipedia-client (1.17.0)
addressable (~> 2.7)
yard (0.9.34)
zeitwerk (2.6.11)
zeitwerk (2.6.12)

PLATFORMS
arm64-darwin-21
Expand Down Expand Up @@ -423,4 +462,4 @@ DEPENDENCIES
yard (~> 0.9.34)

BUNDLED WITH
2.3.22
2.4.21
2 changes: 1 addition & 1 deletion lib/langchain/llm/google_palm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def summarize(text:)
prompt: prompt,
temperature: @defaults[:temperature],
# Most models have a context length of 2048 tokens (except for the newest models, which support 4096).
max_tokens: 2048
max_tokens: 256
)
end

Expand Down
Loading

0 comments on commit 5b5a43b

Please sign in to comment.