langchainrb 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +3 -1
- data/README.md +7 -5
- data/examples/store_and_query_with_pinecone.rb +5 -4
- data/lib/langchain/agent/base.rb +5 -0
- data/lib/langchain/agent/chain_of_thought_agent/chain_of_thought_agent.rb +22 -10
- data/lib/langchain/agent/chain_of_thought_agent/chain_of_thought_agent_prompt.yaml +26 -0
- data/lib/langchain/agent/sql_query_agent/sql_query_agent.rb +7 -7
- data/lib/langchain/agent/sql_query_agent/sql_query_agent_answer_prompt.yaml +11 -0
- data/lib/langchain/agent/sql_query_agent/sql_query_agent_sql_prompt.yaml +21 -0
- data/lib/langchain/chunker/base.rb +15 -0
- data/lib/langchain/chunker/text.rb +38 -0
- data/lib/langchain/contextual_logger.rb +60 -0
- data/lib/langchain/conversation.rb +35 -4
- data/lib/langchain/data.rb +4 -0
- data/lib/langchain/llm/google_palm.rb +3 -2
- data/lib/langchain/llm/openai.rb +16 -6
- data/lib/langchain/llm/prompts/summarize_template.yaml +9 -0
- data/lib/langchain/llm/replicate.rb +1 -1
- data/lib/langchain/prompt/base.rb +2 -2
- data/lib/langchain/tool/base.rb +9 -3
- data/lib/langchain/tool/calculator.rb +2 -2
- data/lib/langchain/tool/database.rb +3 -3
- data/lib/langchain/tool/{serp_api.rb → google_search.rb} +9 -9
- data/lib/langchain/tool/ruby_code_interpreter.rb +1 -1
- data/lib/langchain/tool/weather.rb +2 -2
- data/lib/langchain/tool/wikipedia.rb +1 -1
- data/lib/langchain/utils/token_length/base_validator.rb +38 -0
- data/lib/langchain/utils/token_length/google_palm_validator.rb +9 -29
- data/lib/langchain/utils/token_length/openai_validator.rb +10 -27
- data/lib/langchain/utils/token_length/token_limit_exceeded.rb +17 -0
- data/lib/langchain/vectorsearch/base.rb +6 -0
- data/lib/langchain/vectorsearch/chroma.rb +1 -1
- data/lib/langchain/vectorsearch/hnswlib.rb +2 -2
- data/lib/langchain/vectorsearch/milvus.rb +1 -14
- data/lib/langchain/vectorsearch/pgvector.rb +1 -5
- data/lib/langchain/vectorsearch/pinecone.rb +1 -4
- data/lib/langchain/vectorsearch/qdrant.rb +1 -4
- data/lib/langchain/vectorsearch/weaviate.rb +1 -4
- data/lib/langchain/version.rb +1 -1
- data/lib/langchain.rb +28 -12
- metadata +30 -11
- data/lib/langchain/agent/chain_of_thought_agent/chain_of_thought_agent_prompt.json +0 -10
- data/lib/langchain/agent/sql_query_agent/sql_query_agent_answer_prompt.json +0 -10
- data/lib/langchain/agent/sql_query_agent/sql_query_agent_sql_prompt.json +0 -10
- data/lib/langchain/llm/prompts/summarize_template.json +0 -5
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: langchainrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Bondarev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: baran
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.1.6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.1.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: colorize
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.8.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tiktoken_ruby
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.0.5
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.0.5
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: dotenv-rails
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -456,10 +470,13 @@ files:
|
|
456
470
|
- lib/langchain.rb
|
457
471
|
- lib/langchain/agent/base.rb
|
458
472
|
- lib/langchain/agent/chain_of_thought_agent/chain_of_thought_agent.rb
|
459
|
-
- lib/langchain/agent/chain_of_thought_agent/chain_of_thought_agent_prompt.
|
473
|
+
- lib/langchain/agent/chain_of_thought_agent/chain_of_thought_agent_prompt.yaml
|
460
474
|
- lib/langchain/agent/sql_query_agent/sql_query_agent.rb
|
461
|
-
- lib/langchain/agent/sql_query_agent/sql_query_agent_answer_prompt.
|
462
|
-
- lib/langchain/agent/sql_query_agent/sql_query_agent_sql_prompt.
|
475
|
+
- lib/langchain/agent/sql_query_agent/sql_query_agent_answer_prompt.yaml
|
476
|
+
- lib/langchain/agent/sql_query_agent/sql_query_agent_sql_prompt.yaml
|
477
|
+
- lib/langchain/chunker/base.rb
|
478
|
+
- lib/langchain/chunker/text.rb
|
479
|
+
- lib/langchain/contextual_logger.rb
|
463
480
|
- lib/langchain/conversation.rb
|
464
481
|
- lib/langchain/data.rb
|
465
482
|
- lib/langchain/dependency_helper.rb
|
@@ -469,7 +486,7 @@ files:
|
|
469
486
|
- lib/langchain/llm/google_palm.rb
|
470
487
|
- lib/langchain/llm/hugging_face.rb
|
471
488
|
- lib/langchain/llm/openai.rb
|
472
|
-
- lib/langchain/llm/prompts/summarize_template.
|
489
|
+
- lib/langchain/llm/prompts/summarize_template.yaml
|
473
490
|
- lib/langchain/llm/replicate.rb
|
474
491
|
- lib/langchain/loader.rb
|
475
492
|
- lib/langchain/processors/base.rb
|
@@ -488,12 +505,14 @@ files:
|
|
488
505
|
- lib/langchain/tool/base.rb
|
489
506
|
- lib/langchain/tool/calculator.rb
|
490
507
|
- lib/langchain/tool/database.rb
|
508
|
+
- lib/langchain/tool/google_search.rb
|
491
509
|
- lib/langchain/tool/ruby_code_interpreter.rb
|
492
|
-
- lib/langchain/tool/serp_api.rb
|
493
510
|
- lib/langchain/tool/weather.rb
|
494
511
|
- lib/langchain/tool/wikipedia.rb
|
512
|
+
- lib/langchain/utils/token_length/base_validator.rb
|
495
513
|
- lib/langchain/utils/token_length/google_palm_validator.rb
|
496
514
|
- lib/langchain/utils/token_length/openai_validator.rb
|
515
|
+
- lib/langchain/utils/token_length/token_limit_exceeded.rb
|
497
516
|
- lib/langchain/vectorsearch/base.rb
|
498
517
|
- lib/langchain/vectorsearch/chroma.rb
|
499
518
|
- lib/langchain/vectorsearch/hnswlib.rb
|
@@ -528,7 +547,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
528
547
|
- !ruby/object:Gem::Version
|
529
548
|
version: '0'
|
530
549
|
requirements: []
|
531
|
-
rubygems_version: 3.3
|
550
|
+
rubygems_version: 3.2.3
|
532
551
|
signing_key:
|
533
552
|
specification_version: 4
|
534
553
|
summary: Build LLM-backed Ruby applications with Ruby's LangChain
|
@@ -1,10 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"_type": "prompt",
|
3
|
-
"template": "Today is {date} and you can use tools to get new information. Answer the following questions as best you can using the following tools:\n\n{tools}\n\nUse the following format:\n\nQuestion: the input question you must answer\nThought: you should always think about what to do\nAction: the action to take, should be one of {tool_names}\nAction Input: the input to the action\nObservation: the result of the action\n... (this Thought/Action/Action Input/Observation can repeat N times)\nThought: I now know the final answer\nFinal Answer: the final answer to the original input question\n\nBegin!\n\nQuestion: {question}\nThought:",
|
4
|
-
"input_variables": [
|
5
|
-
"date",
|
6
|
-
"question",
|
7
|
-
"tools",
|
8
|
-
"tool_names"
|
9
|
-
]
|
10
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"_type": "prompt",
|
3
|
-
"template":
|
4
|
-
"Given an input question and results of a SQL query, look at the results and return the answer. Use the following format:\nQuestion: {question}\nThe SQL query: {sql_query}\nResult of the SQLQuery: {results}\nFinal answer: Final answer here",
|
5
|
-
"input_variables": [
|
6
|
-
"question",
|
7
|
-
"sql_query",
|
8
|
-
"results"
|
9
|
-
]
|
10
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"_type": "prompt",
|
3
|
-
"template":
|
4
|
-
"Given an input question, create a syntactically correct {dialect} query to run, then return the query in valid SQL.\nNever query for all the columns from a specific table, only ask for a the few relevant columns given the question.\nPay attention to use only the column names that you can see in the schema description. Be careful to not query for columns that do not exist. Pay attention to which column is in which table. Also, qualify column names with the table name when needed.\nOnly use the tables listed below.\n{schema}\nUse the following format:\nQuestion: {question}\nSQLQuery:",
|
5
|
-
"input_variables": [
|
6
|
-
"dialect",
|
7
|
-
"schema",
|
8
|
-
"question"
|
9
|
-
]
|
10
|
-
}
|