status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,944
Question Answering over Docs giving cryptic error upon query
After ingesting some markdown files using a slightly modified version of the question-answering over docs example, I ran the qa.py script as it was in the example ``` # qa.py import faiss from langchain import OpenAI, HuggingFaceHub, LLMChain from langchain.chains import VectorDBQAWithSourcesChain import pickle...
https://github.com/langchain-ai/langchain/issues/2944
https://github.com/langchain-ai/langchain/pull/3026
3453b7457ca60227430d85e6f6f58a2aafae559d
19c85aa9907765c0a2dbe7c46e9d5dd2d6df0f30
2023-04-15T15:38:36Z
python
2023-04-18T03:28:01Z
langchain/chains/combine_documents/refine.py
"""Combine by mapping first chain over all, then stuffing into final chain.""" inputs = self._construct_initial_inputs(docs, **kwargs) res = self.initial_llm_chain.predict(**inputs) refine_steps = [res] for doc in docs[1:]: base_inputs = self._construct_refine_inputs(doc, res...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,944
Question Answering over Docs giving cryptic error upon query
After ingesting some markdown files using a slightly modified version of the question-answering over docs example, I ran the qa.py script as it was in the example ``` # qa.py import faiss from langchain import OpenAI, HuggingFaceHub, LLMChain from langchain.chains import VectorDBQAWithSourcesChain import pickle...
https://github.com/langchain-ai/langchain/issues/2944
https://github.com/langchain-ai/langchain/pull/3026
3453b7457ca60227430d85e6f6f58a2aafae559d
19c85aa9907765c0a2dbe7c46e9d5dd2d6df0f30
2023-04-15T15:38:36Z
python
2023-04-18T03:28:01Z
langchain/chains/combine_documents/refine.py
if self.return_intermediate_steps: extra_return_dict = {"intermediate_steps": refine_steps} else: extra_return_dict = {} return res, extra_return_dict def _construct_refine_inputs(self, doc: Document, res: str) -> Dict[str, Any]: base_info = {"page_content": doc.page_...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,944
Question Answering over Docs giving cryptic error upon query
After ingesting some markdown files using a slightly modified version of the question-answering over docs example, I ran the qa.py script as it was in the example ``` # qa.py import faiss from langchain import OpenAI, HuggingFaceHub, LLMChain from langchain.chains import VectorDBQAWithSourcesChain import pickle...
https://github.com/langchain-ai/langchain/issues/2944
https://github.com/langchain-ai/langchain/pull/3026
3453b7457ca60227430d85e6f6f58a2aafae559d
19c85aa9907765c0a2dbe7c46e9d5dd2d6df0f30
2023-04-15T15:38:36Z
python
2023-04-18T03:28:01Z
langchain/chains/combine_documents/stuff.py
"""Chain that combines documents by stuffing into context.""" from typing import Any, Dict, List, Optional, Tuple from pydantic import Extra, Field, root_validator from langchain.chains.combine_documents.base import BaseCombineDocumentsChain from langchain.chains.llm import LLMChain from langchain.docstore.document imp...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,944
Question Answering over Docs giving cryptic error upon query
After ingesting some markdown files using a slightly modified version of the question-answering over docs example, I ran the qa.py script as it was in the example ``` # qa.py import faiss from langchain import OpenAI, HuggingFaceHub, LLMChain from langchain.chains import VectorDBQAWithSourcesChain import pickle...
https://github.com/langchain-ai/langchain/issues/2944
https://github.com/langchain-ai/langchain/pull/3026
3453b7457ca60227430d85e6f6f58a2aafae559d
19c85aa9907765c0a2dbe7c46e9d5dd2d6df0f30
2023-04-15T15:38:36Z
python
2023-04-18T03:28:01Z
langchain/chains/combine_documents/stuff.py
"""Configuration for this pydantic object.""" extra = Extra.forbid arbitrary_types_allowed = True @root_validator(pre=True) def get_default_document_variable_name(cls, values: Dict) -> Dict: """Get default document variable name, if not provided.""" if "document_variable_name" no...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,944
Question Answering over Docs giving cryptic error upon query
After ingesting some markdown files using a slightly modified version of the question-answering over docs example, I ran the qa.py script as it was in the example ``` # qa.py import faiss from langchain import OpenAI, HuggingFaceHub, LLMChain from langchain.chains import VectorDBQAWithSourcesChain import pickle...
https://github.com/langchain-ai/langchain/issues/2944
https://github.com/langchain-ai/langchain/pull/3026
3453b7457ca60227430d85e6f6f58a2aafae559d
19c85aa9907765c0a2dbe7c46e9d5dd2d6df0f30
2023-04-15T15:38:36Z
python
2023-04-18T03:28:01Z
langchain/chains/combine_documents/stuff.py
doc_dicts = [] for doc in docs: base_info = {"page_content": doc.page_content} base_info.update(doc.metadata) document_info = { k: base_info[k] for k in self.document_prompt.input_variables } doc_dicts.append(document_info) ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,944
Question Answering over Docs giving cryptic error upon query
After ingesting some markdown files using a slightly modified version of the question-answering over docs example, I ran the qa.py script as it was in the example ``` # qa.py import faiss from langchain import OpenAI, HuggingFaceHub, LLMChain from langchain.chains import VectorDBQAWithSourcesChain import pickle...
https://github.com/langchain-ai/langchain/issues/2944
https://github.com/langchain-ai/langchain/pull/3026
3453b7457ca60227430d85e6f6f58a2aafae559d
19c85aa9907765c0a2dbe7c46e9d5dd2d6df0f30
2023-04-15T15:38:36Z
python
2023-04-18T03:28:01Z
langchain/chains/combine_documents/stuff.py
"""Get the prompt length by formatting the prompt.""" inputs = self._get_inputs(docs, **kwargs) prompt = self.llm_chain.prompt.format(**inputs) return self.llm_chain.llm.get_num_tokens(prompt) def combine_docs(self, docs: List[Document], **kwargs: Any) -> Tuple[str, dict]: """Stuff a...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,944
Question Answering over Docs giving cryptic error upon query
After ingesting some markdown files using a slightly modified version of the question-answering over docs example, I ran the qa.py script as it was in the example ``` # qa.py import faiss from langchain import OpenAI, HuggingFaceHub, LLMChain from langchain.chains import VectorDBQAWithSourcesChain import pickle...
https://github.com/langchain-ai/langchain/issues/2944
https://github.com/langchain-ai/langchain/pull/3026
3453b7457ca60227430d85e6f6f58a2aafae559d
19c85aa9907765c0a2dbe7c46e9d5dd2d6df0f30
2023-04-15T15:38:36Z
python
2023-04-18T03:28:01Z
tests/unit_tests/chains/test_combine_documents.py
"""Test functionality related to combining documents.""" from typing import Any, List import pytest from langchain.chains.combine_documents.map_reduce import ( _collapse_docs, _split_list_of_docs, ) from langchain.docstore.document import Document def _fake_docs_len_func(docs: List[Document]) -> int: return...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,944
Question Answering over Docs giving cryptic error upon query
After ingesting some markdown files using a slightly modified version of the question-answering over docs example, I ran the qa.py script as it was in the example ``` # qa.py import faiss from langchain import OpenAI, HuggingFaceHub, LLMChain from langchain.chains import VectorDBQAWithSourcesChain import pickle...
https://github.com/langchain-ai/langchain/issues/2944
https://github.com/langchain-ai/langchain/pull/3026
3453b7457ca60227430d85e6f6f58a2aafae559d
19c85aa9907765c0a2dbe7c46e9d5dd2d6df0f30
2023-04-15T15:38:36Z
python
2023-04-18T03:28:01Z
tests/unit_tests/chains/test_combine_documents.py
"""Test splitting works with just two docs.""" docs = [Document(page_content="foo"), Document(page_content="bar")] doc_list = _split_list_of_docs(docs, _fake_docs_len_func, 100) assert doc_list == [docs] def test__split_list_works_correctly() -> None: """Test splitting works correctly.""" docs = [ ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,944
Question Answering over Docs giving cryptic error upon query
After ingesting some markdown files using a slightly modified version of the question-answering over docs example, I ran the qa.py script as it was in the example ``` # qa.py import faiss from langchain import OpenAI, HuggingFaceHub, LLMChain from langchain.chains import VectorDBQAWithSourcesChain import pickle...
https://github.com/langchain-ai/langchain/issues/2944
https://github.com/langchain-ai/langchain/pull/3026
3453b7457ca60227430d85e6f6f58a2aafae559d
19c85aa9907765c0a2dbe7c46e9d5dd2d6df0f30
2023-04-15T15:38:36Z
python
2023-04-18T03:28:01Z
tests/unit_tests/chains/test_combine_documents.py
"""Test collapse documents functionality when no metadata.""" docs = [ Document(page_content="foo"), Document(page_content="bar"), Document(page_content="baz"), ] output = _collapse_docs(docs, _fake_combine_docs_func) expected_output = Document(page_content="foobarbaz") asser...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,944
Question Answering over Docs giving cryptic error upon query
After ingesting some markdown files using a slightly modified version of the question-answering over docs example, I ran the qa.py script as it was in the example ``` # qa.py import faiss from langchain import OpenAI, HuggingFaceHub, LLMChain from langchain.chains import VectorDBQAWithSourcesChain import pickle...
https://github.com/langchain-ai/langchain/issues/2944
https://github.com/langchain-ai/langchain/pull/3026
3453b7457ca60227430d85e6f6f58a2aafae559d
19c85aa9907765c0a2dbe7c46e9d5dd2d6df0f30
2023-04-15T15:38:36Z
python
2023-04-18T03:28:01Z
tests/unit_tests/chains/test_combine_documents.py
"""Test collapse documents functionality when only one document present.""" docs = [Document(page_content="foo")] output = _collapse_docs(docs, _fake_combine_docs_func) assert output == docs[0] docs = [Document(page_content="foo", metadata={"source": "a"})] output = _collapse_docs(docs, _f...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,874
Redundunt piece of code
In Agents -> loading.py on line 40 there is a redundant piece of code. ``` if config_type not in AGENT_TO_CLASS: raise ValueError(f"Loading {config_type} agent not supported") ```
https://github.com/langchain-ai/langchain/issues/2874
https://github.com/langchain-ai/langchain/pull/2934
b40f90ea042b20440cb7c1a9e70a6e4cd4a0089c
ae7ed31386c10cee1683419a4ab45562830bf8eb
2023-04-14T05:28:42Z
python
2023-04-18T04:05:48Z
langchain/agents/loading.py
"""Functionality for loading agents.""" import json from pathlib import Path from typing import Any, Dict, List, Optional, Type, Union import yaml from langchain.agents.agent import BaseSingleActionAgent from langchain.agents.agent_types import AgentType from langchain.agents.chat.base import ChatAgent from langchain.a...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,874
Redundunt piece of code
In Agents -> loading.py on line 40 there is a redundant piece of code. ``` if config_type not in AGENT_TO_CLASS: raise ValueError(f"Loading {config_type} agent not supported") ```
https://github.com/langchain-ai/langchain/issues/2874
https://github.com/langchain-ai/langchain/pull/2934
b40f90ea042b20440cb7c1a9e70a6e4cd4a0089c
ae7ed31386c10cee1683419a4ab45562830bf8eb
2023-04-14T05:28:42Z
python
2023-04-18T04:05:48Z
langchain/agents/loading.py
config: dict, llm: BaseLLM, tools: List[Tool], **kwargs: Any ) -> BaseSingleActionAgent: config_type = config.pop("_type") if config_type not in AGENT_TO_CLASS: raise ValueError(f"Loading {config_type} agent not supported") if config_type not in AGENT_TO_CLASS: raise ValueError(f"Loading {co...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,874
Redundunt piece of code
In Agents -> loading.py on line 40 there is a redundant piece of code. ``` if config_type not in AGENT_TO_CLASS: raise ValueError(f"Loading {config_type} agent not supported") ```
https://github.com/langchain-ai/langchain/issues/2874
https://github.com/langchain-ai/langchain/pull/2934
b40f90ea042b20440cb7c1a9e70a6e4cd4a0089c
ae7ed31386c10cee1683419a4ab45562830bf8eb
2023-04-14T05:28:42Z
python
2023-04-18T04:05:48Z
langchain/agents/loading.py
) -> BaseSingleActionAgent: """Load agent from Config Dict.""" if "_type" not in config: raise ValueError("Must specify an agent Type in config") load_from_tools = config.pop("load_from_llm_and_tools", False) if load_from_tools: if llm is None: raise ValueError( ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,874
Redundunt piece of code
In Agents -> loading.py on line 40 there is a redundant piece of code. ``` if config_type not in AGENT_TO_CLASS: raise ValueError(f"Loading {config_type} agent not supported") ```
https://github.com/langchain-ai/langchain/issues/2874
https://github.com/langchain-ai/langchain/pull/2934
b40f90ea042b20440cb7c1a9e70a6e4cd4a0089c
ae7ed31386c10cee1683419a4ab45562830bf8eb
2023-04-14T05:28:42Z
python
2023-04-18T04:05:48Z
langchain/agents/loading.py
"""Unified method for loading a agent from LangChainHub or local fs.""" if hub_result := try_load_from_hub( path, _load_agent_from_file, "agents", {"json", "yaml"} ): return hub_result else: return _load_agent_from_file(path, **kwargs) def _load_agent_from_file( file: Union[str, ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,057
Error when parsing code from LLM response ValueError: Could not parse LLM output:
Sometimes the LLM response (generated code) tends to miss the ending ticks "```". Therefore causing the text parsing to fail due to `not enough values to unpack`. Suggest to simply the `_, action, _' to just `action` then with index Error message below ``` > Entering new AgentExecutor chain... Traceback (mo...
https://github.com/langchain-ai/langchain/issues/3057
https://github.com/langchain-ai/langchain/pull/3058
db968284f8f3964630f119c95cca923f112ad47b
2984ad39645c80411cee5e7f77a3c116b88d008e
2023-04-18T04:13:20Z
python
2023-04-18T04:42:13Z
langchain/agents/chat/output_parser.py
import json from typing import Union from langchain.agents.agent import AgentOutputParser from langchain.schema import AgentAction, AgentFinish FINAL_ANSWER_ACTION = "Final Answer:" class ChatOutputParser(AgentOutputParser): def parse(self, text: str) -> Union[AgentAction, AgentFinish]: if FINAL_ANSWER_ACTI...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,157
Missing Observation and Thought prefix in output
The console output when running a tool is missing the "Observation" and "Thought" prefixes. I noticed this when using the SQL Toolkit, but other tools are likely affected. Here is the current INCORRECT output format: ``` > Entering new AgentExecutor chain... Action: list_tables_sql_db Action Input: ""invoice_...
https://github.com/langchain-ai/langchain/issues/3157
https://github.com/langchain-ai/langchain/pull/3158
126d7f11dd17a8ea71a4427951f10cefc862ba3a
0b542661b46d42ee501c6681a4519f2c4e76de23
2023-04-19T15:15:26Z
python
2023-04-19T16:00:10Z
langchain/tools/base.py
"""Base implementation for tools or skills.""" from abc import ABC, abstractmethod from inspect import signature from typing import Any, Dict, Optional, Sequence, Tuple, Type, Union from pydantic import BaseModel, Extra, Field, validate_arguments, validator from langchain.callbacks import get_callback_manager from lang...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,157
Missing Observation and Thought prefix in output
The console output when running a tool is missing the "Observation" and "Thought" prefixes. I noticed this when using the SQL Toolkit, but other tools are likely affected. Here is the current INCORRECT output format: ``` > Entering new AgentExecutor chain... Action: list_tables_sql_db Action Input: ""invoice_...
https://github.com/langchain-ai/langchain/issues/3157
https://github.com/langchain-ai/langchain/pull/3158
126d7f11dd17a8ea71a4427951f10cefc862ba3a
0b542661b46d42ee501c6681a4519f2c4e76de23
2023-04-19T15:15:26Z
python
2023-04-19T16:00:10Z
langchain/tools/base.py
if self.args_schema is not None: return self.args_schema.schema()["properties"] else: inferred_model = validate_arguments(self._run).model schema = inferred_model.schema()["properties"] valid_keys = signature(self._run).parameters return {k: schema[k...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,157
Missing Observation and Thought prefix in output
The console output when running a tool is missing the "Observation" and "Thought" prefixes. I noticed this when using the SQL Toolkit, but other tools are likely affected. Here is the current INCORRECT output format: ``` > Entering new AgentExecutor chain... Action: list_tables_sql_db Action Input: ""invoice_...
https://github.com/langchain-ai/langchain/issues/3157
https://github.com/langchain-ai/langchain/pull/3158
126d7f11dd17a8ea71a4427951f10cefc862ba3a
0b542661b46d42ee501c6681a4519f2c4e76de23
2023-04-19T15:15:26Z
python
2023-04-19T16:00:10Z
langchain/tools/base.py
"""Use the tool.""" @abstractmethod async def _arun(self, *args: Any, **kwargs: Any) -> str: """Use the tool asynchronously.""" def run( self, tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = "green", color: Optional[s...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,157
Missing Observation and Thought prefix in output
The console output when running a tool is missing the "Observation" and "Thought" prefixes. I noticed this when using the SQL Toolkit, but other tools are likely affected. Here is the current INCORRECT output format: ``` > Entering new AgentExecutor chain... Action: list_tables_sql_db Action Input: ""invoice_...
https://github.com/langchain-ai/langchain/issues/3157
https://github.com/langchain-ai/langchain/pull/3158
126d7f11dd17a8ea71a4427951f10cefc862ba3a
0b542661b46d42ee501c6681a4519f2c4e76de23
2023-04-19T15:15:26Z
python
2023-04-19T16:00:10Z
langchain/tools/base.py
except (Exception, KeyboardInterrupt) as e: self.callback_manager.on_tool_error(e, verbose=verbose_) raise e self.callback_manager.on_tool_end( observation, verbose=verbose_, color=color, name=self.name, **kwargs ) return observation async def arun( ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,157
Missing Observation and Thought prefix in output
The console output when running a tool is missing the "Observation" and "Thought" prefixes. I noticed this when using the SQL Toolkit, but other tools are likely affected. Here is the current INCORRECT output format: ``` > Entering new AgentExecutor chain... Action: list_tables_sql_db Action Input: ""invoice_...
https://github.com/langchain-ai/langchain/issues/3157
https://github.com/langchain-ai/langchain/pull/3158
126d7f11dd17a8ea71a4427951f10cefc862ba3a
0b542661b46d42ee501c6681a4519f2c4e76de23
2023-04-19T15:15:26Z
python
2023-04-19T16:00:10Z
langchain/tools/base.py
self.callback_manager.on_tool_start( {"name": self.name, "description": self.description}, tool_input if isinstance(tool_input, str) else str(tool_input), verbose=verbose_, color=start_color, **kwargs, ) try: ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,301
Output using llamacpp is garbage
Hi there, Trying to setup a langchain with llamacpp as a first step to use langchain offline: `from langchain.llms import LlamaCpp llm = LlamaCpp(model_path="../llama/models/ggml-vicuna-13b-4bit-rev1.bin") text = "Question: What NFL team won the Super Bowl in the year Justin Bieber was born? Answer: Let's thi...
https://github.com/langchain-ai/langchain/issues/3301
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-21T14:01:59Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
"""Wrapper around llama.cpp.""" import logging from typing import Any, Dict, List, Optional from pydantic import Field, root_validator from langchain.llms.base import LLM logger = logging.getLogger(__name__) class LlamaCpp(LLM):
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,301
Output using llamacpp is garbage
Hi there, Trying to setup a langchain with llamacpp as a first step to use langchain offline: `from langchain.llms import LlamaCpp llm = LlamaCpp(model_path="../llama/models/ggml-vicuna-13b-4bit-rev1.bin") text = "Question: What NFL team won the Super Bowl in the year Justin Bieber was born? Answer: Let's thi...
https://github.com/langchain-ai/langchain/issues/3301
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-21T14:01:59Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
"""Wrapper around the llama.cpp model. To use, you should have the llama-cpp-python library installed, and provide the path to the Llama model as a named parameter to the constructor. Check out: https://github.com/abetlen/llama-cpp-python Example: .. code-block:: python from langchai...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,301
Output using llamacpp is garbage
Hi there, Trying to setup a langchain with llamacpp as a first step to use langchain offline: `from langchain.llms import LlamaCpp llm = LlamaCpp(model_path="../llama/models/ggml-vicuna-13b-4bit-rev1.bin") text = "Question: What NFL team won the Super Bowl in the year Justin Bieber was born? Answer: Let's thi...
https://github.com/langchain-ai/langchain/issues/3301
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-21T14:01:59Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
use_mlock: bool = Field(False, alias="use_mlock") """Force system to keep model in RAM.""" n_threads: Optional[int] = Field(None, alias="n_threads") """Number of threads to use. If None, the number of threads is automatically determined.""" n_batch: Optional[int] = Field(8, alias="n_batch") """...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,301
Output using llamacpp is garbage
Hi there, Trying to setup a langchain with llamacpp as a first step to use langchain offline: `from langchain.llms import LlamaCpp llm = LlamaCpp(model_path="../llama/models/ggml-vicuna-13b-4bit-rev1.bin") text = "Question: What NFL team won the Super Bowl in the year Justin Bieber was born? Answer: Let's thi...
https://github.com/langchain-ai/langchain/issues/3301
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-21T14:01:59Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
"""Validate that llama-cpp-python library is installed.""" model_path = values["model_path"] n_ctx = values["n_ctx"] n_parts = values["n_parts"] seed = values["seed"] f16_kv = values["f16_kv"] logits_all = values["logits_all"] vocab_only = values["vocab_only"]
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,301
Output using llamacpp is garbage
Hi there, Trying to setup a langchain with llamacpp as a first step to use langchain offline: `from langchain.llms import LlamaCpp llm = LlamaCpp(model_path="../llama/models/ggml-vicuna-13b-4bit-rev1.bin") text = "Question: What NFL team won the Super Bowl in the year Justin Bieber was born? Answer: Let's thi...
https://github.com/langchain-ai/langchain/issues/3301
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-21T14:01:59Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
use_mlock = values["use_mlock"] n_threads = values["n_threads"] n_batch = values["n_batch"] last_n_tokens_size = values["last_n_tokens_size"] try: from llama_cpp import Llama values["client"] = Llama( model_path=model_path, n_ctx=n_...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,301
Output using llamacpp is garbage
Hi there, Trying to setup a langchain with llamacpp as a first step to use langchain offline: `from langchain.llms import LlamaCpp llm = LlamaCpp(model_path="../llama/models/ggml-vicuna-13b-4bit-rev1.bin") text = "Question: What NFL team won the Super Bowl in the year Justin Bieber was born? Answer: Let's thi...
https://github.com/langchain-ai/langchain/issues/3301
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-21T14:01:59Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
"""Get the default parameters for calling llama_cpp.""" return { "suffix": self.suffix, "max_tokens": self.max_tokens, "temperature": self.temperature, "top_p": self.top_p, "logprobs": self.logprobs, "echo": self.echo, "stop_seq...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,301
Output using llamacpp is garbage
Hi there, Trying to setup a langchain with llamacpp as a first step to use langchain offline: `from langchain.llms import LlamaCpp llm = LlamaCpp(model_path="../llama/models/ggml-vicuna-13b-4bit-rev1.bin") text = "Question: What NFL team won the Super Bowl in the year Justin Bieber was born? Answer: Let's thi...
https://github.com/langchain-ai/langchain/issues/3301
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-21T14:01:59Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
The generated text. Example: .. code-block:: python from langchain.llms import LlamaCppEmbeddings llm = LlamaCppEmbeddings(model_path="/path/to/local/llama/model.bin") llm("This is a prompt.") """ params = self._default_params i...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,241
llama.cpp => model runs fine but bad output
Hi, Windows 11 environement Python: 3.10.11 I installed - llama-cpp-python and it works fine and provides output - transformers - pytorch Code run: ``` from langchain.llms import LlamaCpp from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think ste...
https://github.com/langchain-ai/langchain/issues/3241
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-20T20:36:45Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
"""Wrapper around llama.cpp.""" import logging from typing import Any, Dict, List, Optional from pydantic import Field, root_validator from langchain.llms.base import LLM logger = logging.getLogger(__name__) class LlamaCpp(LLM):
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,241
llama.cpp => model runs fine but bad output
Hi, Windows 11 environement Python: 3.10.11 I installed - llama-cpp-python and it works fine and provides output - transformers - pytorch Code run: ``` from langchain.llms import LlamaCpp from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think ste...
https://github.com/langchain-ai/langchain/issues/3241
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-20T20:36:45Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
"""Wrapper around the llama.cpp model. To use, you should have the llama-cpp-python library installed, and provide the path to the Llama model as a named parameter to the constructor. Check out: https://github.com/abetlen/llama-cpp-python Example: .. code-block:: python from langchai...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,241
llama.cpp => model runs fine but bad output
Hi, Windows 11 environement Python: 3.10.11 I installed - llama-cpp-python and it works fine and provides output - transformers - pytorch Code run: ``` from langchain.llms import LlamaCpp from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think ste...
https://github.com/langchain-ai/langchain/issues/3241
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-20T20:36:45Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
use_mlock: bool = Field(False, alias="use_mlock") """Force system to keep model in RAM.""" n_threads: Optional[int] = Field(None, alias="n_threads") """Number of threads to use. If None, the number of threads is automatically determined.""" n_batch: Optional[int] = Field(8, alias="n_batch") """...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,241
llama.cpp => model runs fine but bad output
Hi, Windows 11 environement Python: 3.10.11 I installed - llama-cpp-python and it works fine and provides output - transformers - pytorch Code run: ``` from langchain.llms import LlamaCpp from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think ste...
https://github.com/langchain-ai/langchain/issues/3241
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-20T20:36:45Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
"""Validate that llama-cpp-python library is installed.""" model_path = values["model_path"] n_ctx = values["n_ctx"] n_parts = values["n_parts"] seed = values["seed"] f16_kv = values["f16_kv"] logits_all = values["logits_all"] vocab_only = values["vocab_only"]
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,241
llama.cpp => model runs fine but bad output
Hi, Windows 11 environement Python: 3.10.11 I installed - llama-cpp-python and it works fine and provides output - transformers - pytorch Code run: ``` from langchain.llms import LlamaCpp from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think ste...
https://github.com/langchain-ai/langchain/issues/3241
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-20T20:36:45Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
use_mlock = values["use_mlock"] n_threads = values["n_threads"] n_batch = values["n_batch"] last_n_tokens_size = values["last_n_tokens_size"] try: from llama_cpp import Llama values["client"] = Llama( model_path=model_path, n_ctx=n_...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,241
llama.cpp => model runs fine but bad output
Hi, Windows 11 environement Python: 3.10.11 I installed - llama-cpp-python and it works fine and provides output - transformers - pytorch Code run: ``` from langchain.llms import LlamaCpp from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think ste...
https://github.com/langchain-ai/langchain/issues/3241
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-20T20:36:45Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
"""Get the default parameters for calling llama_cpp.""" return { "suffix": self.suffix, "max_tokens": self.max_tokens, "temperature": self.temperature, "top_p": self.top_p, "logprobs": self.logprobs, "echo": self.echo, "stop_seq...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,241
llama.cpp => model runs fine but bad output
Hi, Windows 11 environement Python: 3.10.11 I installed - llama-cpp-python and it works fine and provides output - transformers - pytorch Code run: ``` from langchain.llms import LlamaCpp from langchain import PromptTemplate, LLMChain template = """Question: {question} Answer: Let's think ste...
https://github.com/langchain-ai/langchain/issues/3241
https://github.com/langchain-ai/langchain/pull/3320
3a1bdce3f51e302d468807e980455d676c0f5fd6
77bb6c99f7ee189ce3734c47b27e70dc237bbce7
2023-04-20T20:36:45Z
python
2023-04-23T01:46:55Z
langchain/llms/llamacpp.py
The generated text. Example: .. code-block:: python from langchain.llms import LlamaCppEmbeddings llm = LlamaCppEmbeddings(model_path="/path/to/local/llama/model.bin") llm("This is a prompt.") """ params = self._default_params i...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,404
marathon_times.ipynb: mismatched text and code
Text mentions inflation and tuition: Here is the prompt comparing inflation and college tuition. Code is about marathon times: agent.run(["What were the winning boston marathon times for the past 5 years? Generate a table of the names, countries of origin, and times."])
https://github.com/langchain-ai/langchain/issues/3404
https://github.com/langchain-ai/langchain/pull/3408
b4de839ed8a1bea7425a6923b2cd635068b6015a
73bc70b4fa7bb69647d9dbe81943b88ce6ccc180
2023-04-23T21:06:49Z
python
2023-04-24T01:14:11Z
langchain/tools/ddg_search/__init__.py
"""DuckDuckGo Search API toolkit."""
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,384
ValueError in cosine_similarity when using FAISS index as vector store
Getting the below error ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "...\langchain\vectorstores\faiss.py", line 285, in max_marginal_relevance_search docs = self.max_marginal_relevance_search_by_vector(embedding, k, fetch_k) File "...\langchain\vectorstores\faiss.py...
https://github.com/langchain-ai/langchain/issues/3384
https://github.com/langchain-ai/langchain/pull/3475
53b14de636080e09e128d829aafa9ea34ac34a94
b2564a63911f8a77272ac9e93e5558384f00155c
2023-04-23T07:51:56Z
python
2023-04-25T02:54:15Z
langchain/math_utils.py
"""Math utils.""" from typing import List, Union import numpy as np Matrix = Union[List[List[float]], List[np.ndarray], np.ndarray] def cosine_similarity(X: Matrix, Y: Matrix) -> np.ndarray: """Row-wise cosine similarity between two equal-width matrices.""" if len(X) == 0 or len(Y) == 0: return np.array...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,384
ValueError in cosine_similarity when using FAISS index as vector store
Getting the below error ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "...\langchain\vectorstores\faiss.py", line 285, in max_marginal_relevance_search docs = self.max_marginal_relevance_search_by_vector(embedding, k, fetch_k) File "...\langchain\vectorstores\faiss.py...
https://github.com/langchain-ai/langchain/issues/3384
https://github.com/langchain-ai/langchain/pull/3475
53b14de636080e09e128d829aafa9ea34ac34a94
b2564a63911f8a77272ac9e93e5558384f00155c
2023-04-23T07:51:56Z
python
2023-04-25T02:54:15Z
langchain/vectorstores/utils.py
"""Utility functions for working with vectors and vectorstores.""" from typing import List import numpy as np from langchain.math_utils import cosine_similarity def maximal_marginal_relevance(
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,384
ValueError in cosine_similarity when using FAISS index as vector store
Getting the below error ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "...\langchain\vectorstores\faiss.py", line 285, in max_marginal_relevance_search docs = self.max_marginal_relevance_search_by_vector(embedding, k, fetch_k) File "...\langchain\vectorstores\faiss.py...
https://github.com/langchain-ai/langchain/issues/3384
https://github.com/langchain-ai/langchain/pull/3475
53b14de636080e09e128d829aafa9ea34ac34a94
b2564a63911f8a77272ac9e93e5558384f00155c
2023-04-23T07:51:56Z
python
2023-04-25T02:54:15Z
langchain/vectorstores/utils.py
query_embedding: np.ndarray, embedding_list: list, lambda_mult: float = 0.5, k: int = 4, ) -> List[int]: """Calculate maximal marginal relevance.""" if min(k, len(embedding_list)) <= 0: return [] similarity_to_query = cosine_similarity([query_embedding], embedding_list)[0] most_simil...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
1,766
Update poetry lock to allow SQLAlchemy v2
It seems that #1578 adds support for SQLAlchemy v2 but the [poetry lock file](https://github.com/hwchase17/langchain/blob/8685d53adcdd0310e76349ecb4e2b87f980c4673/poetry.lock#L6211) is still at 1.4.46.
https://github.com/langchain-ai/langchain/issues/1766
https://github.com/langchain-ai/langchain/pull/3310
7c2c73af5f15799c9326e99ed15c4a30fd19ad11
b7658059643cd2f8fa58a2132b7d723638445ebc
2023-03-19T01:48:23Z
python
2023-04-25T04:10:56Z
langchain/sql_database.py
"""SQLAlchemy wrapper around a database.""" from __future__ import annotations import warnings from typing import Any, Iterable, List, Optional from sqlalchemy import MetaData, Table, create_engine, inspect, select, text from sqlalchemy.engine import Engine from sqlalchemy.exc import ProgrammingError, SQLAlchemyError f...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
1,766
Update poetry lock to allow SQLAlchemy v2
It seems that #1578 adds support for SQLAlchemy v2 but the [poetry lock file](https://github.com/hwchase17/langchain/blob/8685d53adcdd0310e76349ecb4e2b87f980c4673/poetry.lock#L6211) is still at 1.4.46.
https://github.com/langchain-ai/langchain/issues/1766
https://github.com/langchain-ai/langchain/pull/3310
7c2c73af5f15799c9326e99ed15c4a30fd19ad11
b7658059643cd2f8fa58a2132b7d723638445ebc
2023-03-19T01:48:23Z
python
2023-04-25T04:10:56Z
langchain/sql_database.py
if include_tables and ignore_tables: raise ValueError("Cannot specify both include_tables and ignore_tables") self._inspector = inspect(self._engine) self._all_tables = set( self._inspector.get_table_names(schema=schema) + (self._inspector.get_view_n...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
1,766
Update poetry lock to allow SQLAlchemy v2
It seems that #1578 adds support for SQLAlchemy v2 but the [poetry lock file](https://github.com/hwchase17/langchain/blob/8685d53adcdd0310e76349ecb4e2b87f980c4673/poetry.lock#L6211) is still at 1.4.46.
https://github.com/langchain-ai/langchain/issues/1766
https://github.com/langchain-ai/langchain/pull/3310
7c2c73af5f15799c9326e99ed15c4a30fd19ad11
b7658059643cd2f8fa58a2132b7d723638445ebc
2023-03-19T01:48:23Z
python
2023-04-25T04:10:56Z
langchain/sql_database.py
if self._custom_table_info: if not isinstance(self._custom_table_info, dict): raise TypeError( "table_info must be a dictionary with table names as keys and the " "desired table info as values" ) intersection = ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
1,766
Update poetry lock to allow SQLAlchemy v2
It seems that #1578 adds support for SQLAlchemy v2 but the [poetry lock file](https://github.com/hwchase17/langchain/blob/8685d53adcdd0310e76349ecb4e2b87f980c4673/poetry.lock#L6211) is still at 1.4.46.
https://github.com/langchain-ai/langchain/issues/1766
https://github.com/langchain-ai/langchain/pull/3310
7c2c73af5f15799c9326e99ed15c4a30fd19ad11
b7658059643cd2f8fa58a2132b7d723638445ebc
2023-03-19T01:48:23Z
python
2023-04-25T04:10:56Z
langchain/sql_database.py
"""Return string representation of dialect to use.""" return self._engine.dialect.name def get_usable_table_names(self) -> Iterable[str]: """Get names of tables available.""" if self._include_tables: return self._include_tables return self._all_tables - self._ignore_table...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
1,766
Update poetry lock to allow SQLAlchemy v2
It seems that #1578 adds support for SQLAlchemy v2 but the [poetry lock file](https://github.com/hwchase17/langchain/blob/8685d53adcdd0310e76349ecb4e2b87f980c4673/poetry.lock#L6211) is still at 1.4.46.
https://github.com/langchain-ai/langchain/issues/1766
https://github.com/langchain-ai/langchain/pull/3310
7c2c73af5f15799c9326e99ed15c4a30fd19ad11
b7658059643cd2f8fa58a2132b7d723638445ebc
2023-03-19T01:48:23Z
python
2023-04-25T04:10:56Z
langchain/sql_database.py
all_table_names = table_names meta_tables = [ tbl for tbl in self._metadata.sorted_tables if tbl.name in set(all_table_names) and not (self.dialect == "sqlite" and tbl.name.startswith("sqlite_")) ] tables = [] for table in meta_tables: ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
1,766
Update poetry lock to allow SQLAlchemy v2
It seems that #1578 adds support for SQLAlchemy v2 but the [poetry lock file](https://github.com/hwchase17/langchain/blob/8685d53adcdd0310e76349ecb4e2b87f980c4673/poetry.lock#L6211) is still at 1.4.46.
https://github.com/langchain-ai/langchain/issues/1766
https://github.com/langchain-ai/langchain/pull/3310
7c2c73af5f15799c9326e99ed15c4a30fd19ad11
b7658059643cd2f8fa58a2132b7d723638445ebc
2023-03-19T01:48:23Z
python
2023-04-25T04:10:56Z
langchain/sql_database.py
indexes = self._inspector.get_indexes(table.name) indexes_formatted = "\n".join(map(_format_index, indexes)) return f"Table Indexes:\n{indexes_formatted}" def _get_sample_rows(self, table: Table) -> str: command = select([table]).limit(self._sample_rows_in_table_info) ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
1,766
Update poetry lock to allow SQLAlchemy v2
It seems that #1578 adds support for SQLAlchemy v2 but the [poetry lock file](https://github.com/hwchase17/langchain/blob/8685d53adcdd0310e76349ecb4e2b87f980c4673/poetry.lock#L6211) is still at 1.4.46.
https://github.com/langchain-ai/langchain/issues/1766
https://github.com/langchain-ai/langchain/pull/3310
7c2c73af5f15799c9326e99ed15c4a30fd19ad11
b7658059643cd2f8fa58a2132b7d723638445ebc
2023-03-19T01:48:23Z
python
2023-04-25T04:10:56Z
langchain/sql_database.py
"""Execute a SQL command and return a string representing the results. If the statement returns rows, a string of the results is returned. If the statement returns no rows, an empty string is returned. """ with self._engine.begin() as connection: if self._schema is not None: ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
1,766
Update poetry lock to allow SQLAlchemy v2
It seems that #1578 adds support for SQLAlchemy v2 but the [poetry lock file](https://github.com/hwchase17/langchain/blob/8685d53adcdd0310e76349ecb4e2b87f980c4673/poetry.lock#L6211) is still at 1.4.46.
https://github.com/langchain-ai/langchain/issues/1766
https://github.com/langchain-ai/langchain/pull/3310
7c2c73af5f15799c9326e99ed15c4a30fd19ad11
b7658059643cd2f8fa58a2132b7d723638445ebc
2023-03-19T01:48:23Z
python
2023-04-25T04:10:56Z
langchain/sql_database.py
"""Get information about specified tables. Follows best practices as specified in: Rajkumar et al, 2022 (https://arxiv.org/abs/2204.00498) If `sample_rows_in_table_info`, the specified number of sample rows will be appended to each table description. This can increase performance as ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
langchain/vectorstores/weaviate.py
"""Wrapper around weaviate vector database.""" from __future__ import annotations from typing import Any, Dict, Iterable, List, Optional, Type from uuid import uuid4 import numpy as np from langchain.docstore.document import Document from langchain.embeddings.base import Embeddings from langchain.utils import get_from_...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
langchain/vectorstores/weaviate.py
client = kwargs.get("client") if client is not None: return client weaviate_url = get_from_dict_or_env(kwargs, "weaviate_url", "WEAVIATE_URL") weaviate_api_key = get_from_dict_or_env( kwargs, "weaviate_api_key", "WEAVIATE_API_KEY", None ) try: import weaviate except Impor...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
langchain/vectorstores/weaviate.py
weaviate = Weaviate(client, index_name, text_key) """ def __init__( self, client: Any, index_name: str, text_key: str, embedding: Optional[Embeddings] = None, attributes: Optional[List[str]] = None, ): """Initialize with Weaviate client.""" try...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
langchain/vectorstores/weaviate.py
self, texts: Iterable[str], metadatas: Optional[List[dict]] = None, **kwargs: Any, ) -> List[str]: """Upload texts with metadata (properties) to Weaviate.""" from weaviate.util import get_valid_uuid with self._client.batch as batch: ids = [] fo...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
langchain/vectorstores/weaviate.py
self, query: str, k: int = 4, **kwargs: Any ) -> List[Document]: """Return docs most similar to query. Args: query: Text to look up documents similar to. k: Number of Documents to return. Defaults to 4. Returns: List of Documents most similar to the query....
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
langchain/vectorstores/weaviate.py
self, embedding: List[float], k: int = 4, **kwargs: Any ) -> List[Document]: """Look up similar documents by embedding vector in Weaviate.""" vector = {"vector": embedding} query_obj = self._client.query.get(self._index_name, self._query_attrs) if kwargs.get("where_filter"): ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
langchain/vectorstores/weaviate.py
fetch_k: Number of Documents to fetch to pass to MMR algorithm. lambda_mult: Number between 0 and 1 that determines the degree of diversity among the results with 0 corresponding to maximum diversity and 1 to minimum diversity. Defaults...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
langchain/vectorstores/weaviate.py
k: Number of Documents to return. Defaults to 4. fetch_k: Number of Documents to fetch to pass to MMR algorithm. lambda_mult: Number between 0 and 1 that determines the degree of diversity among the results with 0 corresponding to maximum diversity...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
langchain/vectorstores/weaviate.py
return docs @classmethod def from_texts( cls: Type[Weaviate], texts: List[str], embedding: Embeddings, metadatas: Optional[List[dict]] = None, **kwargs: Any, ) -> Weaviate: """Construct Weaviate wrapper from raw documents. This is a user-friendly inter...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
langchain/vectorstores/weaviate.py
text_key = "text" schema = _default_schema(index_name) attributes = list(metadatas[0].keys()) if metadatas else None if not client.schema.contains(schema): client.schema.create_class(schema) with client.batch as batch: for i, text in enumerate(texts): ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
tests/integration_tests/vectorstores/test_weaviate.py
"""Test Weaviate functionality.""" import logging import os from typing import Generator, Union import pytest from weaviate import Client from langchain.docstore.document import Document from langchain.embeddings.openai import OpenAIEmbeddings from langchain.vectorstores.weaviate import Weaviate logging.basicConfig(lev...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
tests/integration_tests/vectorstores/test_weaviate.py
self, weaviate_url: str, embedding_openai: OpenAIEmbeddings ) -> None: """Test end to end construction and search without metadata.""" texts = ["foo", "bar", "baz"] docsearch = Weaviate.from_texts( texts, embedding_openai, weaviate_url=weaviate_url, ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
tests/integration_tests/vectorstores/test_weaviate.py
self, weaviate_url: str, embedding_openai: OpenAIEmbeddings ) -> None: """Test end to end construction and search with metadata.""" texts = ["foo", "bar", "baz"] metadatas = [{"page": i} for i in range(len(texts))] docsearch = Weaviate.from_texts( texts, embedding_openai,...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
tests/integration_tests/vectorstores/test_weaviate.py
output = docsearch.max_marginal_relevance_search( "foo", k=2, fetch_k=3, lambda_mult=0.0 ) assert output == [ Document(page_content="foo", metadata={"page": 0}), Document(page_content="bar", metadata={"page": 1}), ] @pytest.mark.vcr(ignore_localhost=True) ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
2,695
Allow Weaviate initialization with alternative embedding implementation
I would like to provide an 'embeddings' parameter for the initialization of the Weaviate vector store, as I do not want to start the Weaviate server with the OpenAI key in order to make use of embeddings through the Azure OpenAI Service. The addition of the embeddings parameter affects the __init__ method, as shown...
https://github.com/langchain-ai/langchain/issues/2695
https://github.com/langchain-ai/langchain/pull/3608
615812581ea3175b3ae9ec59036008d013052396
440c98e24bf3f18c132694309872592ef550e1bc
2023-04-11T05:19:00Z
python
2023-04-27T04:45:03Z
tests/integration_tests/vectorstores/test_weaviate.py
Document(page_content="foo", metadata={"page": 0}), Document(page_content="bar", metadata={"page": 1}), ] @pytest.mark.vcr(ignore_localhost=True) def test_max_marginal_relevance_search_with_filter( self, weaviate_url: str, embedding_openai: OpenAIEmbeddings ) -> None: """...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,664
import error when importing `from langchain import OpenAI` on 0.0.151
got the following error when running today: ``` File "venv/lib/python3.11/site-packages/langchain/__init__.py", line 6, in <module> from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain File "venv/lib/python3.11/site-packages/langchain/agents/__init__.py", line 2, in <module> from l...
https://github.com/langchain-ai/langchain/issues/3664
https://github.com/langchain-ai/langchain/pull/3667
708787dddb2fa3cdb2d1dabefa00c01ffec572f6
1b5721c999c9fc310cefec383666f43c80ec9620
2023-04-27T16:24:30Z
python
2023-04-27T18:39:01Z
langchain/utilities/bash.py
"""Wrapper around subprocess to run commands.""" import re import subprocess from typing import List, Union from uuid import uuid4 import pexpect class BashProcess:
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,664
import error when importing `from langchain import OpenAI` on 0.0.151
got the following error when running today: ``` File "venv/lib/python3.11/site-packages/langchain/__init__.py", line 6, in <module> from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain File "venv/lib/python3.11/site-packages/langchain/agents/__init__.py", line 2, in <module> from l...
https://github.com/langchain-ai/langchain/issues/3664
https://github.com/langchain-ai/langchain/pull/3667
708787dddb2fa3cdb2d1dabefa00c01ffec572f6
1b5721c999c9fc310cefec383666f43c80ec9620
2023-04-27T16:24:30Z
python
2023-04-27T18:39:01Z
langchain/utilities/bash.py
"""Executes bash commands and returns the output.""" def __init__( self, strip_newlines: bool = False, return_err_output: bool = False, persistent: bool = False, ): """Initialize with stripping newlines.""" self.strip_newlines = strip_newlines self.return_...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,664
import error when importing `from langchain import OpenAI` on 0.0.151
got the following error when running today: ``` File "venv/lib/python3.11/site-packages/langchain/__init__.py", line 6, in <module> from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain File "venv/lib/python3.11/site-packages/langchain/agents/__init__.py", line 2, in <module> from l...
https://github.com/langchain-ai/langchain/issues/3664
https://github.com/langchain-ai/langchain/pull/3667
708787dddb2fa3cdb2d1dabefa00c01ffec572f6
1b5721c999c9fc310cefec383666f43c80ec9620
2023-04-27T16:24:30Z
python
2023-04-27T18:39:01Z
langchain/utilities/bash.py
"""Run commands and return final output.""" if isinstance(commands, str): commands = [commands] commands = ";".join(commands) if self.process is not None: return self._run_persistent( commands, ) else: return self._run(comma...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,664
import error when importing `from langchain import OpenAI` on 0.0.151
got the following error when running today: ``` File "venv/lib/python3.11/site-packages/langchain/__init__.py", line 6, in <module> from langchain.agents import MRKLChain, ReActChain, SelfAskWithSearchChain File "venv/lib/python3.11/site-packages/langchain/agents/__init__.py", line 2, in <module> from l...
https://github.com/langchain-ai/langchain/issues/3664
https://github.com/langchain-ai/langchain/pull/3667
708787dddb2fa3cdb2d1dabefa00c01ffec572f6
1b5721c999c9fc310cefec383666f43c80ec9620
2023-04-27T16:24:30Z
python
2023-04-27T18:39:01Z
langchain/utilities/bash.py
pattern = re.escape(command) + r"\s*\n" output = re.sub(pattern, "", output, count=1) return output.strip() def _run_persistent(self, command: str) -> str: """Run commands and return final output.""" if self.process is None: raise ValueError("Process not initialized") ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
"""Wrapper around ChromaDB embeddings platform.""" from __future__ import annotations import logging import uuid from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Tuple, Type import numpy as np from langchain.docstore.document import Document from langchain.embeddings.base import Embeddings from la...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
return [doc for doc, _ in _results_to_docs_and_scores(results)] def _results_to_docs_and_scores(results: Any) -> List[Tuple[Document, float]]: return [ (Document(page_content=result[0], metadata=result[1] or {}), result[2]) for result in zip( results["documents"][0], ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
self, collection_name: str = _LANGCHAIN_DEFAULT_COLLECTION_NAME, embedding_function: Optional[Embeddings] = None, persist_directory: Optional[str] = None, client_settings: Optional[chromadb.config.Settings] = None, collection_metadata: Optional[Dict] = None, client: Optio...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
import chromadb.config except ImportError: raise ValueError( "Could not import chromadb python package. " "Please install it with `pip install chromadb`." ) if client is not None: self._client = client else: if clien...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
self, query_texts: Optional[List[str]] = None, query_embeddings: Optional[List[List[float]]] = None, n_results: int = 4, where: Optional[Dict[str, str]] = None, ) -> List[Document]: """Query the chroma collection.""" for i in range(n_results, 0, -1): try: ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
self, texts: Iterable[str], metadatas: Optional[List[dict]] = None, ids: Optional[List[str]] = None, **kwargs: Any, ) -> List[str]: """Run more texts through the embeddings and add to the vectorstore. Args: texts (Iterable[str]): Texts to add to the vector...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
self, query: str, k: int = 4, filter: Optional[Dict[str, str]] = None, **kwargs: Any, ) -> List[Document]: """Run similarity search with Chroma. Args: query (str): Query text to search for. k (int): Number of results to return. Defaults to 4. ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
self, embedding: List[float], k: int = 4, filter: Optional[Dict[str, str]] = None, **kwargs: Any, ) -> List[Document]: """Return docs most similar to embedding vector. Args: embedding: Embedding to look up documents similar to. k: Number of Doc...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
self, query: str, k: int = 4, filter: Optional[Dict[str, str]] = None, **kwargs: Any, ) -> List[Tuple[Document, float]]: """Run similarity search with Chroma with distance. Args: query (str): Query text to search for. k (int): Number of results...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
query_embeddings=[query_embedding], n_results=k, where=filter ) return _results_to_docs_and_scores(results) def max_marginal_relevance_search_by_vector( self, embedding: List[float], k: int = 4, fetch_k: int = 20, lambda_mult: float = 0.5, filter: ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
where=filter, include=["metadatas", "documents", "distances", "embeddings"], ) mmr_selected = maximal_marginal_relevance( np.array(embedding, dtype=np.float32), results["embeddings"][0], k=k, lambda_mult=lambda_mult, ) candidate...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
to maximum diversity and 1 to minimum diversity. Defaults to 0.5. filter (Optional[Dict[str, str]]): Filter by metadata. Defaults to None. Returns: List of Documents selected by maximal marginal relevance. """ if self._embedding_function is None: ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
"""Update a document in the collection. Args: document_id (str): ID of the document to update. document (Document): Document to update. """ text = document.page_content metadata = document.metadata self._collection.update_document(document_id, text, metada...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
If a persist_directory is specified, the collection will be persisted there. Otherwise, the data will be ephemeral in-memory. Args: texts (List[str]): List of texts to add to the collection. collection_name (str): Name of the collection to create. persist_directory (O...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
langchain/vectorstores/chroma.py
client_settings: Optional[chromadb.config.Settings] = None, client: Optional[chromadb.Client] = None, **kwargs: Any, ) -> Chroma: """Create a Chroma vectorstore from a list of documents. If a persist_directory is specified, the collection will be persisted there. Otherwise,...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
tests/integration_tests/vectorstores/test_chroma.py
"""Test Chroma functionality.""" import pytest from langchain.docstore.document import Document from langchain.vectorstores import Chroma from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings def test_chroma() -> None:
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
tests/integration_tests/vectorstores/test_chroma.py
"""Test end to end construction and search.""" texts = ["foo", "bar", "baz"] docsearch = Chroma.from_texts( collection_name="test_collection", texts=texts, embedding=FakeEmbeddings() ) output = docsearch.similarity_search("foo", k=1) assert output == [Document(page_content="foo")] @pytest.ma...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
tests/integration_tests/vectorstores/test_chroma.py
"""Test end to end construction and scored search.""" texts = ["foo", "bar", "baz"] metadatas = [{"page": str(i)} for i in range(len(texts))] docsearch = Chroma.from_texts( collection_name="test_collection", texts=texts, embedding=FakeEmbeddings(), metadatas=metadatas, ) ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
tests/integration_tests/vectorstores/test_chroma.py
"""Test end to end construction and scored search with metadata filtering.""" texts = ["far", "bar", "baz"] metadatas = [{"first_letter": "{}".format(text[0])} for text in texts] docsearch = Chroma.from_texts( collection_name="test_collection", texts=texts, embedding=FakeEmbeddings()...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,628
Chroma.py max_marginal_relevance_search_by_vector method currently broken
Using MMR with Chroma currently does not work because the max_marginal_relevance_search_by_vector method calls self.__query_collection with the parameter "include:", but "include" is not an accepted parameter for __query_collection. This appears to be a regression introduced with #3372 Excerpt from max_marginal_rel...
https://github.com/langchain-ai/langchain/issues/3628
https://github.com/langchain-ai/langchain/pull/3897
3e1cb31f63b5c7147939feca7f8095377f64e145
245131097557b73774197b01e326206fa2a1b83a
2023-04-27T00:21:42Z
python
2023-05-01T17:47:15Z
tests/integration_tests/vectorstores/test_chroma.py
"""Test end to end construction and search, with persistence.""" chroma_persist_dir = "./tests/persist_dir" collection_name = "test_collection" texts = ["foo", "bar", "baz"] docsearch = Chroma.from_texts( collection_name=collection_name, texts=texts, embedding=FakeEmbeddings(), ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,988
LangChain openAI callback doesn't allow finetuned models
Hi all! I have an [application](https://github.com/ur-whitelab/BO-LIFT) based on langchain. A few months ago, I used it with fine-tuned (FT) models. We added a token usage counter later, and I haven't tried fine-tuned models again since then. Recently we have been interested in using (FT) models again, but the ...
https://github.com/langchain-ai/langchain/issues/3988
https://github.com/langchain-ai/langchain/pull/4009
aa383559999b3d6a781c62ed7f8589fef8892879
f08a76250fe8995fb3f05bf785677070922d4b0d
2023-05-02T18:00:22Z
python
2023-05-02T23:19:57Z
langchain/callbacks/openai_info.py
"""Callback Handler that prints to std out.""" from typing import Any, Dict, List, Optional, Union from langchain.callbacks.base import BaseCallbackHandler from langchain.schema import AgentAction, AgentFinish, LLMResult def get_openai_model_cost_per_1k_tokens( model_name: str, is_completion: bool = False ) -> floa...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,988
LangChain openAI callback doesn't allow finetuned models
Hi all! I have an [application](https://github.com/ur-whitelab/BO-LIFT) based on langchain. A few months ago, I used it with fine-tuned (FT) models. We added a token usage counter later, and I haven't tried fine-tuned models again since then. Recently we have been interested in using (FT) models again, but the ...
https://github.com/langchain-ai/langchain/issues/3988
https://github.com/langchain-ai/langchain/pull/4009
aa383559999b3d6a781c62ed7f8589fef8892879
f08a76250fe8995fb3f05bf785677070922d4b0d
2023-05-02T18:00:22Z
python
2023-05-02T23:19:57Z
langchain/callbacks/openai_info.py
model_name.lower() + ("-completion" if is_completion and model_name.startswith("gpt-4") else ""), None, ) if cost is None: raise ValueError( f"Unknown model: {model_name}. Please provide a valid OpenAI model name." "Known models are: " + ", ".join(model_cost_mappi...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,988
LangChain openAI callback doesn't allow finetuned models
Hi all! I have an [application](https://github.com/ur-whitelab/BO-LIFT) based on langchain. A few months ago, I used it with fine-tuned (FT) models. We added a token usage counter later, and I haven't tried fine-tuned models again since then. Recently we have been interested in using (FT) models again, but the ...
https://github.com/langchain-ai/langchain/issues/3988
https://github.com/langchain-ai/langchain/pull/4009
aa383559999b3d6a781c62ed7f8589fef8892879
f08a76250fe8995fb3f05bf785677070922d4b0d
2023-05-02T18:00:22Z
python
2023-05-02T23:19:57Z
langchain/callbacks/openai_info.py
self, serialized: Dict[str, Any], prompts: List[str], **kwargs: Any ) -> None: """Print out the prompts.""" pass def on_llm_new_token(self, token: str, **kwargs: Any) -> None: """Print out the token.""" pass def on_llm_end(self, response: LLMResult, **kwargs: Any) -> None: ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,988
LangChain openAI callback doesn't allow finetuned models
Hi all! I have an [application](https://github.com/ur-whitelab/BO-LIFT) based on langchain. A few months ago, I used it with fine-tuned (FT) models. We added a token usage counter later, and I haven't tried fine-tuned models again since then. Recently we have been interested in using (FT) models again, but the ...
https://github.com/langchain-ai/langchain/issues/3988
https://github.com/langchain-ai/langchain/pull/4009
aa383559999b3d6a781c62ed7f8589fef8892879
f08a76250fe8995fb3f05bf785677070922d4b0d
2023-05-02T18:00:22Z
python
2023-05-02T23:19:57Z
langchain/callbacks/openai_info.py
self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any ) -> None: """Do nothing.""" pass def on_chain_start( self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any ) -> None: """Print out that we are entering a chain.""" pass def on_chain...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
3,988
LangChain openAI callback doesn't allow finetuned models
Hi all! I have an [application](https://github.com/ur-whitelab/BO-LIFT) based on langchain. A few months ago, I used it with fine-tuned (FT) models. We added a token usage counter later, and I haven't tried fine-tuned models again since then. Recently we have been interested in using (FT) models again, but the ...
https://github.com/langchain-ai/langchain/issues/3988
https://github.com/langchain-ai/langchain/pull/4009
aa383559999b3d6a781c62ed7f8589fef8892879
f08a76250fe8995fb3f05bf785677070922d4b0d
2023-05-02T18:00:22Z
python
2023-05-02T23:19:57Z
langchain/callbacks/openai_info.py
self, output: str, color: Optional[str] = None, observation_prefix: Optional[str] = None, llm_prefix: Optional[str] = None, **kwargs: Any, ) -> None: """If not the final action, print out observation.""" pass def on_tool_error( self, error: Union[E...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
4,053
Tools with partials (Partial functions not yet supported in tools)
We commonly used this pattern to create tools: ```py from langchain.tools import Tool from functools import partial def foo(x, y): return y Tool.from_function( func=partial(foo, "bar"), name = "foo", description="foobar" ) ``` which as of 0.0.148 (I think) gives a pydantic error "Par...
https://github.com/langchain-ai/langchain/issues/4053
https://github.com/langchain-ai/langchain/pull/4058
7e967aa4d581bec8b29e9ea44267505b0bad18b9
afa9d1292b0a152e36d338dde7b02f0b93bd37d9
2023-05-03T17:28:46Z
python
2023-05-03T20:16:41Z
langchain/tools/base.py
"""Base implementation for tools or skills.""" from __future__ import annotations import warnings from abc import ABC, abstractmethod from functools import partial from inspect import signature from typing import Any, Awaitable, Callable, Dict, Optional, Tuple, Type, Union from pydantic import ( BaseModel, Extr...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
4,053
Tools with partials (Partial functions not yet supported in tools)
We commonly used this pattern to create tools: ```py from langchain.tools import Tool from functools import partial def foo(x, y): return y Tool.from_function( func=partial(foo, "bar"), name = "foo", description="foobar" ) ``` which as of 0.0.148 (I think) gives a pydantic error "Par...
https://github.com/langchain-ai/langchain/issues/4053
https://github.com/langchain-ai/langchain/pull/4058
7e967aa4d581bec8b29e9ea44267505b0bad18b9
afa9d1292b0a152e36d338dde7b02f0b93bd37d9
2023-05-03T17:28:46Z
python
2023-05-03T20:16:41Z
langchain/tools/base.py
"""Metaclass for BaseTool to ensure the provided args_schema doesn't silently ignored.""" def __new__( cls: Type[ToolMetaclass], name: str, bases: Tuple[Type, ...], dct: dict ) -> ToolMetaclass: """Create the definition of the new tool class.""" schema_type: Optional[Type[BaseModel]]...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
4,053
Tools with partials (Partial functions not yet supported in tools)
We commonly used this pattern to create tools: ```py from langchain.tools import Tool from functools import partial def foo(x, y): return y Tool.from_function( func=partial(foo, "bar"), name = "foo", description="foobar" ) ``` which as of 0.0.148 (I think) gives a pydantic error "Par...
https://github.com/langchain-ai/langchain/issues/4053
https://github.com/langchain-ai/langchain/pull/4058
7e967aa4d581bec8b29e9ea44267505b0bad18b9
afa9d1292b0a152e36d338dde7b02f0b93bd37d9
2023-05-03T17:28:46Z
python
2023-05-03T20:16:41Z
langchain/tools/base.py
name: str, model: BaseModel, field_names: list ) -> Type[BaseModel]: """Create a pydantic model with only a subset of model's fields.""" fields = { field_name: ( model.__fields__[field_name].type_, model.__fields__[field_name].default, ) for field_name in field_na...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
4,053
Tools with partials (Partial functions not yet supported in tools)
We commonly used this pattern to create tools: ```py from langchain.tools import Tool from functools import partial def foo(x, y): return y Tool.from_function( func=partial(foo, "bar"), name = "foo", description="foobar" ) ``` which as of 0.0.148 (I think) gives a pydantic error "Par...
https://github.com/langchain-ai/langchain/issues/4053
https://github.com/langchain-ai/langchain/pull/4058
7e967aa4d581bec8b29e9ea44267505b0bad18b9
afa9d1292b0a152e36d338dde7b02f0b93bd37d9
2023-05-03T17:28:46Z
python
2023-05-03T20:16:41Z
langchain/tools/base.py
"""Configuration for the pydantic model.""" extra = Extra.forbid arbitrary_types_allowed = True def create_schema_from_function( model_name: str, func: Callable, ) -> Type[BaseModel]: """Create a pydantic schema from a function's signature.""" validated = validate_arguments(func, config=_SchemaC...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
4,053
Tools with partials (Partial functions not yet supported in tools)
We commonly used this pattern to create tools: ```py from langchain.tools import Tool from functools import partial def foo(x, y): return y Tool.from_function( func=partial(foo, "bar"), name = "foo", description="foobar" ) ``` which as of 0.0.148 (I think) gives a pydantic error "Par...
https://github.com/langchain-ai/langchain/issues/4053
https://github.com/langchain-ai/langchain/pull/4058
7e967aa4d581bec8b29e9ea44267505b0bad18b9
afa9d1292b0a152e36d338dde7b02f0b93bd37d9
2023-05-03T17:28:46Z
python
2023-05-03T20:16:41Z
langchain/tools/base.py
"""Interface LangChain tools must implement.""" name: str """The unique name of the tool that clearly communicates its purpose.""" description: str """Used to tell the model how/when/why to use the tool. You can provide few-shot examples as a part of the description. """ args_schema: Op...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
4,053
Tools with partials (Partial functions not yet supported in tools)
We commonly used this pattern to create tools: ```py from langchain.tools import Tool from functools import partial def foo(x, y): return y Tool.from_function( func=partial(foo, "bar"), name = "foo", description="foobar" ) ``` which as of 0.0.148 (I think) gives a pydantic error "Par...
https://github.com/langchain-ai/langchain/issues/4053
https://github.com/langchain-ai/langchain/pull/4058
7e967aa4d581bec8b29e9ea44267505b0bad18b9
afa9d1292b0a152e36d338dde7b02f0b93bd37d9
2023-05-03T17:28:46Z
python
2023-05-03T20:16:41Z
langchain/tools/base.py
"""Configuration for this pydantic object.""" extra = Extra.forbid arbitrary_types_allowed = True @property def is_single_input(self) -> bool: """Whether the tool only accepts a single input.""" return len(self.args) == 1 @property def args(self) -> dict: if self....
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
4,053
Tools with partials (Partial functions not yet supported in tools)
We commonly used this pattern to create tools: ```py from langchain.tools import Tool from functools import partial def foo(x, y): return y Tool.from_function( func=partial(foo, "bar"), name = "foo", description="foobar" ) ``` which as of 0.0.148 (I think) gives a pydantic error "Par...
https://github.com/langchain-ai/langchain/issues/4053
https://github.com/langchain-ai/langchain/pull/4058
7e967aa4d581bec8b29e9ea44267505b0bad18b9
afa9d1292b0a152e36d338dde7b02f0b93bd37d9
2023-05-03T17:28:46Z
python
2023-05-03T20:16:41Z
langchain/tools/base.py
"""Raise deprecation warning if callback_manager is used.""" if values.get("callback_manager") is not None: warnings.warn( "callback_manager is deprecated. Please use callbacks instead.", DeprecationWarning, ) values["callbacks"] = values.pop("...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
4,053
Tools with partials (Partial functions not yet supported in tools)
We commonly used this pattern to create tools: ```py from langchain.tools import Tool from functools import partial def foo(x, y): return y Tool.from_function( func=partial(foo, "bar"), name = "foo", description="foobar" ) ``` which as of 0.0.148 (I think) gives a pydantic error "Par...
https://github.com/langchain-ai/langchain/issues/4053
https://github.com/langchain-ai/langchain/pull/4058
7e967aa4d581bec8b29e9ea44267505b0bad18b9
afa9d1292b0a152e36d338dde7b02f0b93bd37d9
2023-05-03T17:28:46Z
python
2023-05-03T20:16:41Z
langchain/tools/base.py
if isinstance(tool_input, str): return (tool_input,), {} else: return (), tool_input def run( self, tool_input: Union[str, Dict], verbose: Optional[bool] = None, start_color: Optional[str] = "green", color: Optional[str] = "green", call...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
4,053
Tools with partials (Partial functions not yet supported in tools)
We commonly used this pattern to create tools: ```py from langchain.tools import Tool from functools import partial def foo(x, y): return y Tool.from_function( func=partial(foo, "bar"), name = "foo", description="foobar" ) ``` which as of 0.0.148 (I think) gives a pydantic error "Par...
https://github.com/langchain-ai/langchain/issues/4053
https://github.com/langchain-ai/langchain/pull/4058
7e967aa4d581bec8b29e9ea44267505b0bad18b9
afa9d1292b0a152e36d338dde7b02f0b93bd37d9
2023-05-03T17:28:46Z
python
2023-05-03T20:16:41Z
langchain/tools/base.py
tool_input if isinstance(tool_input, str) else str(tool_input), color=start_color, **kwargs, ) try: tool_args, tool_kwargs = self._to_args_and_kwargs(tool_input) observation = ( self._run(*tool_args, run_manager=run_manager, **tool_kwargs) ...
closed
langchain-ai/langchain
https://github.com/langchain-ai/langchain
4,053
Tools with partials (Partial functions not yet supported in tools)
We commonly used this pattern to create tools: ```py from langchain.tools import Tool from functools import partial def foo(x, y): return y Tool.from_function( func=partial(foo, "bar"), name = "foo", description="foobar" ) ``` which as of 0.0.148 (I think) gives a pydantic error "Par...
https://github.com/langchain-ai/langchain/issues/4053
https://github.com/langchain-ai/langchain/pull/4058
7e967aa4d581bec8b29e9ea44267505b0bad18b9
afa9d1292b0a152e36d338dde7b02f0b93bd37d9
2023-05-03T17:28:46Z
python
2023-05-03T20:16:41Z
langchain/tools/base.py
verbose_ = self.verbose callback_manager = AsyncCallbackManager.configure( callbacks, self.callbacks, verbose=verbose_ ) new_arg_supported = signature(self._arun).parameters.get("run_manager") run_manager = await callback_manager.on_tool_start( {"name": self.name,...