Sydney Runkle
8c6734325b
partners[lint]: run pyupgrade to get code in line with 3.9 standards ( #30781 )
...
Using `pyupgrade` to get all `partners` code up to 3.9 standards
(mostly, fixing old `typing` imports).
2025-04-11 07:18:44 -04:00
Shixian Sheng
94a7fd2497
docs: fix broken hyperlinks in fireworks integration package README ( #30538 )
...
Fix two broken hyperlinks
2025-03-28 15:18:44 -04:00
ccurme
59908f04d4
fireworks: release 0.2.9 ( #30527 )
2025-03-27 16:04:20 +00:00
ccurme
22d1a7d7b6
standard-tests[patch]: require model_name in response_metadata if returns_usage_metadata ( #30497 )
...
We are implementing a token-counting callback handler in
`langchain-core` that is intended to work with all chat models
supporting usage metadata. The callback will aggregate usage metadata by
model. This requires responses to include the model name in its
metadata.
To support this, if a model `returns_usage_metadata`, we check that it
includes a string model name in its `response_metadata` in the
`"model_name"` key.
More context: https://github.com/langchain-ai/langchain/pull/30487
2025-03-26 12:20:53 -04:00
ccurme
db1e340387
fireworks: release 0.2.8 ( #30400 )
2025-03-20 16:15:51 -04:00
ccurme
b86cd8270c
multiple: support strict and method in with_structured_output ( #30385 )
2025-03-20 13:17:07 -04:00
ccurme
806211475a
core[patch]: update structured output tracing ( #30123 )
...
- Trace JSON schema in `options`
- Rename to `ls_structured_output_format`
2025-03-07 13:05:25 -05:00
Erick Friis
1a225fad03
multiple: fix uv path deps ( #29790 )
...
file:// format wasn't working with updates - it doesn't install as an
editable dep
move to tool.uv.sources with path= instead
2025-02-13 21:32:34 +00:00
ccurme
3450bfc806
infra: add UV_FROZEN to makefiles ( #29642 )
...
These are set in Github workflows, but forgot to add them to most
makefiles for convenience when developing locally.
`uv run` will automatically sync the lock file. Because many of our
development dependencies are local installs, it will pick up version
changes and update the lock file. Passing `--frozen` or setting this
environment variable disables the behavior.
2025-02-06 14:36:54 -05:00
ccurme
d172984c91
infra: migrate to uv ( #29566 )
2025-02-06 13:36:26 -05:00
Erick Friis
e074c26a6b
partners/fireworks: release 0.2.7 ( #29487 )
2025-01-29 22:22:18 +00:00
Erick Friis
8f95da4eb1
multiple: structured output tracing standard metadata ( #29421 )
...
Co-authored-by: Chester Curme <chester.curme@gmail.com >
2025-01-29 14:00:26 -08:00
ccurme
86a0720310
fireworks[patch]: update model used in integration tests ( #29342 )
...
No access to firefunction-v1 and -v2.
2025-01-21 11:05:30 -05:00
Erick Friis
fcc9cdd100
multiple: disable socket for unit tests ( #29080 )
2025-01-07 15:31:50 -08:00
Erick Friis
187131c55c
Revert "integrations[patch]: remove non-required chat param defaults" ( #29048 )
...
Reverts langchain-ai/langchain#26730
discuss best way to release default changes (esp openai temperature)
2025-01-06 14:45:34 -08:00
Bagatur
3d7ae8b5d2
integrations[patch]: remove non-required chat param defaults ( #26730 )
...
anthropic:
- max_retries
openai:
- n
- temperature
- max_retries
fireworks
- temperature
groq
- n
- max_retries
- temperature
mistral
- max_retries
- timeout
- max_concurrent_requests
- temperature
- top_p
- safe_mode
---------
Co-authored-by: Erick Friis <erick@langchain.dev >
2025-01-06 22:26:22 +00:00
Erick Friis
907f36a6e9
fireworks: fix lint ( #28821 )
2024-12-19 15:36:36 +00:00
Erick Friis
3b036a1cf2
partners/fireworks: release 0.2.6 ( #28805 )
2024-12-18 22:48:35 +00:00
Bagatur
e4d3ccf62f
json mode standard test ( #25497 )
...
Co-authored-by: Chester Curme <chester.curme@gmail.com >
2024-12-17 18:47:34 +00:00
Erick Friis
0eb7ab65f1
multiple: fix xfailed signatures ( #28597 )
2024-12-06 15:39:47 -08:00
Erick Friis
d1108607f4
multiple: push deprecation removals to 1.0 ( #28236 )
2024-11-20 19:56:29 -08:00
Erick Friis
0dbaf05bb7
standard-tests: rename langchain_standard_tests to langchain_tests, release 0.3.2 ( #28203 )
2024-11-18 19:10:39 -08:00
Erick Friis
6d2004ee7d
multiple: langchain-standard-tests -> langchain-tests ( #28139 )
2024-11-15 11:32:04 -08:00
Bagatur
06420de2e7
integrations[patch]: bump core to 0.3.15 ( #27805 )
2024-10-31 11:27:05 -07:00
Erick Friis
92ae61bcc8
multiple: rely on asyncio_mode auto in tests ( #27200 )
2024-10-15 16:26:38 +00:00
Bagatur
827bdf4f51
fireworks[patch]: Release 0.2.1 ( #27120 )
2024-10-04 18:59:15 +00:00
Bagatur
4935a14314
core,integrations[minor]: Dont error on fields in model_kwargs ( #27110 )
...
Given the current erroring behavior, every time we've moved a kwarg from
model_kwargs and made it its own field that was a breaking change.
Updating this behavior to support the old instantiations /
serializations.
Assuming build_extra_kwargs was not something that itself is being used
externally and needs to be kept backwards compatible
2024-10-04 11:30:27 -07:00
Bagatur
0078493a80
fireworks[patch]: allow tool_choice with multiple tools ( #26999 )
...
https://docs.fireworks.ai/api-reference/post-chatcompletions
2024-09-30 11:28:43 -07:00
Bagatur
e1d113ea84
core,openai,grow,fw[patch]: deprecate bind_functions, update chat mod… ( #26584 )
...
…el api ref
2024-09-17 11:32:39 -07:00
Erick Friis
995dfc6b05
partners/fireworks: release 0.2.0 ( #26467 )
2024-09-13 22:48:16 +00:00
Erick Friis
c2a3021bb0
multiple: pydantic 2 compatibility, v0.3 ( #26443 )
...
Signed-off-by: ChengZi <chen.zhang@zilliz.com >
Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com >
Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com >
Co-authored-by: Dan O'Donovan <dan.odonovan@gmail.com >
Co-authored-by: Tom Daniel Grande <tomdgrande@gmail.com >
Co-authored-by: Grande <Tom.Daniel.Grande@statsbygg.no >
Co-authored-by: Bagatur <baskaryan@gmail.com >
Co-authored-by: ccurme <chester.curme@gmail.com >
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com >
Co-authored-by: Tomaz Bratanic <bratanic.tomaz@gmail.com >
Co-authored-by: ZhangShenao <15201440436@163.com >
Co-authored-by: Friso H. Kingma <fhkingma@gmail.com >
Co-authored-by: ChengZi <chen.zhang@zilliz.com >
Co-authored-by: Nuno Campos <nuno@langchain.dev >
Co-authored-by: Morgante Pell <morgantep@google.com >
2024-09-13 14:38:45 -07:00
Bagatur
dba308447d
fmt
2024-09-04 11:28:04 -07:00
Bagatur
3ec93c2817
standard-tests[patch]: add Ser/Des test
2024-09-04 10:24:06 -07:00
Christophe Bornet
038c287b3a
all: Improve make lint command ( #25344 )
...
* Removed `ruff check --select I` as `I` is already selected and checked
in the main `ruff check` command
* Added checks for non-empty `PYTHON_FILES`
* Run `ruff check` only on `PYTHON_FILES`
Co-authored-by: Erick Friis <erick@langchain.dev >
2024-08-23 18:23:52 -07:00
ccurme
b83f1eb0d5
core, partners: implement standard tracing params for LLMs ( #25410 )
2024-08-16 13:18:09 -04:00
Eugene Yurtsev
eb3870e9d8
fireworks[patch]: Upgrade @root_validators to be pydantic 2 compliant ( #25443 )
...
Update @root_validators to be pydantic 2 compliant
2024-08-15 16:56:48 +00:00
Eugene Yurtsev
5f5e8c9a60
huggingface[patch], pinecone[patch], fireworks[patch], mistralai[patch], voyageai[patch], togetherai[path]: convert Pydantic extras to literals ( #25384 )
...
Backwards compatible change that converts pydantic extras to literals
which is consistent with pydantic 2 usage.
- fireworks
- voyage ai
- mistralai
- mistral ai
- together ai
- huggigng face
- pinecone
2024-08-14 09:55:30 -04:00
Eugene Yurtsev
1c9917dfa2
fireworks[patch]: Fix doc-string for API Referenmce ( #25304 )
2024-08-12 17:16:13 +00:00
Eugene Yurtsev
53ee5770d3
fireworks: Add APIReference for the FireworksEmbeddings model ( #25292 )
...
Add API Reference documentation for the FireworksEmbedding model.
Issue: https://github.com/langchain-ai/langchain/issues/24856
2024-08-12 13:13:43 -04:00
Bagatur
752a71b688
integrations[patch]: release model packages ( #24900 )
2024-07-31 20:48:20 +00:00
Bagatur
8461934c2b
core[patch], integrations[patch]: convert TypedDict to tool schema support ( #24641 )
...
supports following UX
```python
class SubTool(TypedDict):
"""Subtool docstring"""
args: Annotated[Dict[str, Any], {}, "this does bar"]
class Tool(TypedDict):
"""Docstring
Args:
arg1: foo
"""
arg1: str
arg2: Union[int, str]
arg3: Optional[List[SubTool]]
arg4: Annotated[Literal["bar", "baz"], ..., "this does foo"]
arg5: Annotated[Optional[float], None]
```
- can parse google style docstring
- can use Annotated to specify default value (second arg)
- can use Annotated to specify arg description (third arg)
- can have nested complex types
2024-07-31 18:27:24 +00:00
Chuck Wooters
56c2a7f6d4
partners: add missing key name to Field() for ChatFireworks model ( #24721 )
...
**Description:**
In the `ChatFireworks` class definition, the Field() call for the "stop"
("stop_sequences") parameter is missing the "default" keyword.
**Issue:**
Type checker reports "stop_sequences" as a missing arg (not recognizing
the default value is None)
**Dependencies:**
None
**Twitter handle:**
None
2024-07-28 18:40:21 +00:00
Bagatur
b3a23ddf93
integration releases ( #24725 )
...
Release anthropic, openai, groq, mistralai, robocorp
2024-07-26 12:30:10 -07:00
Erick Friis
3dce2e1d35
all: add release notes to pypi ( #24519 )
2024-07-22 13:59:13 -07:00
Bagatur
236e957abb
core,groq,openai,mistralai,robocorp,fireworks,anthropic[patch]: Update BaseModel subclass and instance checks to handle both v1 and proper namespaces ( #24417 )
...
After this PR chat models will correctly handle pydantic 2 with
bind_tools and with_structured_output.
```python
import pydantic
print(pydantic.__version__)
```
2.8.2
```python
from langchain_openai import ChatOpenAI
from pydantic import BaseModel, Field
class Add(BaseModel):
x: int
y: int
model = ChatOpenAI().bind_tools([Add])
print(model.invoke('2 + 5').tool_calls)
model = ChatOpenAI().with_structured_output(Add)
print(type(model.invoke('2 + 5')))
```
```
[{'name': 'Add', 'args': {'x': 2, 'y': 5}, 'id': 'call_PNUFa4pdfNOYXxIMHc6ps2Do', 'type': 'tool_call'}]
<class '__main__.Add'>
```
```python
from langchain_openai import ChatOpenAI
from pydantic.v1 import BaseModel, Field
class Add(BaseModel):
x: int
y: int
model = ChatOpenAI().bind_tools([Add])
print(model.invoke('2 + 5').tool_calls)
model = ChatOpenAI().with_structured_output(Add)
print(type(model.invoke('2 + 5')))
```
```python
[{'name': 'Add', 'args': {'x': 2, 'y': 5}, 'id': 'call_hhiHYP441cp14TtrHKx3Upg0', 'type': 'tool_call'}]
<class '__main__.Add'>
```
Addresses issues: https://github.com/langchain-ai/langchain/issues/22782
---------
Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com >
2024-07-22 20:07:39 +00:00
ccurme
ab2d7821a7
fireworks[patch]: use firefunction-v2 in standard tests ( #24264 )
2024-07-15 13:15:08 +00:00
Bagatur
3aed74a6fc
fireworks[patch]: Release 0.1.5 ( #24203 )
2024-07-12 13:58:58 -07:00
Bagatur
cb5031f22f
integrations[patch]: require core >=0.2.17 ( #24207 )
2024-07-12 20:54:01 +00:00
Bagatur
5fd1e67808
core[minor], integrations...[patch]: Support ToolCall as Tool input and ToolMessage as Tool output ( #24038 )
...
Changes:
- ToolCall, InvalidToolCall and ToolCallChunk can all accept a "type"
parameter now
- LLM integration packages add "type" to all the above
- Tool supports ToolCall inputs that have "type" specified
- Tool outputs ToolMessage when a ToolCall is passed as input
- Tools can separately specify ToolMessage.content and
ToolMessage.raw_output
- Tools emit events for validation errors (using on_tool_error and
on_tool_end)
Example:
```python
@tool("structured_api", response_format="content_and_raw_output")
def _mock_structured_tool_with_raw_output(
arg1: int, arg2: bool, arg3: Optional[dict] = None
) -> Tuple[str, dict]:
"""A Structured Tool"""
return f"{arg1} {arg2}", {"arg1": arg1, "arg2": arg2, "arg3": arg3}
def test_tool_call_input_tool_message_with_raw_output() -> None:
tool_call: Dict = {
"name": "structured_api",
"args": {"arg1": 1, "arg2": True, "arg3": {"img": "base64string..."}},
"id": "123",
"type": "tool_call",
}
expected = ToolMessage("1 True", raw_output=tool_call["args"], tool_call_id="123")
tool = _mock_structured_tool_with_raw_output
actual = tool.invoke(tool_call)
assert actual == expected
tool_call.pop("type")
with pytest.raises(ValidationError):
tool.invoke(tool_call)
actual_content = tool.invoke(tool_call["args"])
assert actual_content == expected.content
```
---------
Co-authored-by: Erick Friis <erick@langchain.dev >
2024-07-11 14:54:02 -07:00
Bagatur
a0c2281540
infra: update mypy 1.10, ruff 0.5 ( #23721 )
...
```python
"""python scripts/update_mypy_ruff.py"""
import glob
import tomllib
from pathlib import Path
import toml
import subprocess
import re
ROOT_DIR = Path(__file__).parents[1]
def main():
for path in glob.glob(str(ROOT_DIR / "libs/**/pyproject.toml"), recursive=True):
print(path)
with open(path, "rb") as f:
pyproject = tomllib.load(f)
try:
pyproject["tool"]["poetry"]["group"]["typing"]["dependencies"]["mypy"] = (
"^1.10"
)
pyproject["tool"]["poetry"]["group"]["lint"]["dependencies"]["ruff"] = (
"^0.5"
)
except KeyError:
continue
with open(path, "w") as f:
toml.dump(pyproject, f)
cwd = "/".join(path.split("/")[:-1])
completed = subprocess.run(
"poetry lock --no-update; poetry install --with typing; poetry run mypy . --no-color",
cwd=cwd,
shell=True,
capture_output=True,
text=True,
)
logs = completed.stdout.split("\n")
to_ignore = {}
for l in logs:
if re.match("^(.*)\:(\d+)\: error:.*\[(.*)\]", l):
path, line_no, error_type = re.match(
"^(.*)\:(\d+)\: error:.*\[(.*)\]", l
).groups()
if (path, line_no) in to_ignore:
to_ignore[(path, line_no)].append(error_type)
else:
to_ignore[(path, line_no)] = [error_type]
print(len(to_ignore))
for (error_path, line_no), error_types in to_ignore.items():
all_errors = ", ".join(error_types)
full_path = f"{cwd}/{error_path}"
try:
with open(full_path, "r") as f:
file_lines = f.readlines()
except FileNotFoundError:
continue
file_lines[int(line_no) - 1] = (
file_lines[int(line_no) - 1][:-1] + f" # type: ignore[{all_errors}]\n"
)
with open(full_path, "w") as f:
f.write("".join(file_lines))
subprocess.run(
"poetry run ruff format .; poetry run ruff --select I --fix .",
cwd=cwd,
shell=True,
capture_output=True,
text=True,
)
if __name__ == "__main__":
main()
```
2024-07-03 10:33:27 -07:00