-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat:Update openapi.yaml with new endpoints and schema modifications for LangSmith #113
Conversation
WalkthroughThe changes in this pull request primarily involve updates to the Changes
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
src/libs/LangSmith/openapi.yaml (2)
7390-7390
: Add documentation for the Canvas endpoint.The endpoint's purpose and expected behavior should be documented to help API consumers understand its usage.
Add a description field to the operation:
operationId: canvas_api_v1_prompts_canvas_post +description: "Endpoint for processing and optimizing prompts using the Canvas feature. This endpoint accepts a PlayGroundGraph containing messages and artifacts, and returns the processed results." requestBody:
15611-15664
: Add descriptions for enum values.The
artifact_length
andreading_level
enums would benefit from descriptions explaining the implications of each value.Add descriptions for the enum values:
artifact_length: title: Artifact Length enum: - shortest - short - long - longest type: string nullable: true + description: | + Controls the length of the generated artifact: + * shortest - Minimal length output + * short - Concise output + * long - Detailed output + * longest - Comprehensive output reading_level: title: Reading Level enum: - child - teenager - college - phd type: string nullable: true + description: | + Controls the complexity of the generated content: + * child - Simple language suitable for children + * teenager - Language suitable for teenagers + * college - College-level complexity + * phd - Advanced academic level
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (128)
src/libs/LangSmith/Generated/JsonConverters.AIMessageChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.AIMessageChunkTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.AIMessageType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.AIMessageTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ChatMessageChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ChatMessageChunkTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ChatMessageType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ChatMessageTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.FunctionMessageChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.FunctionMessageChunkTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.FunctionMessageType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.FunctionMessageTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.HumanMessageChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.HumanMessageChunkTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.HumanMessageType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.HumanMessageTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.InvalidToolCallType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.InvalidToolCallTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.MessagesItem.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.PlayGroundGraphArtifactLength.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.PlayGroundGraphArtifactLengthNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.PlayGroundGraphMessageDiscriminatorType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.PlayGroundGraphMessageDiscriminatorTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.PlayGroundGraphReadingLevel.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.PlayGroundGraphReadingLevelNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.SystemMessageChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.SystemMessageChunkTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.SystemMessageType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.SystemMessageTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ToolCallChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ToolCallChunkTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ToolCallType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ToolCallTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ToolMessageChunkStatus.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ToolMessageChunkStatusNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ToolMessageChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ToolMessageChunkTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ToolMessageStatus.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ToolMessageStatusNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ToolMessageType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonConverters.ToolMessageTypeNullable.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonSerializerContext.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/JsonSerializerContextTypes.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.IPromptsClient.Canvas.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.AIMessage.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.AIMessageAdditionalKwargs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunk.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkAdditionalKwargs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkContentVariant2Item.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkResponseMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.AIMessageChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.AIMessageContentVariant2Item.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.AIMessageResponseMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.AIMessageType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.Artifact.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ArtifactContent.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ChatMessage.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ChatMessageAdditionalKwargs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ChatMessageChunk.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ChatMessageChunkAdditionalKwargs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ChatMessageChunkContentVariant2Item.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ChatMessageChunkResponseMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ChatMessageChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ChatMessageContentVariant2Item.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ChatMessageResponseMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ChatMessageType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.FunctionMessage.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.FunctionMessageAdditionalKwargs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.FunctionMessageChunk.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.FunctionMessageChunkAdditionalKwargs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.FunctionMessageChunkContentVariant2Item.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.FunctionMessageChunkResponseMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.FunctionMessageChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.FunctionMessageContentVariant2Item.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.FunctionMessageResponseMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.FunctionMessageType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.Highlight.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.HumanMessage.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.HumanMessageAdditionalKwargs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.HumanMessageChunk.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.HumanMessageChunkAdditionalKwargs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.HumanMessageChunkContentVariant2Item.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.HumanMessageChunkResponseMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.HumanMessageChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.HumanMessageContentVariant2Item.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.HumanMessageResponseMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.HumanMessageType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.InputTokenDetails.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.InvalidToolCall.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.InvalidToolCallType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.MessagesItem.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.OutputTokenDetails.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.PlayGroundGraph.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.PlayGroundGraphArtifactLength.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.PlayGroundGraphMessageDiscriminator.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.PlayGroundGraphMessageDiscriminatorType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.PlayGroundGraphReadingLevel.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.SystemMessage.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.SystemMessageAdditionalKwargs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.SystemMessageChunk.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.SystemMessageChunkAdditionalKwargs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.SystemMessageChunkContentVariant2Item.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.SystemMessageChunkResponseMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.SystemMessageChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.SystemMessageContentVariant2Item.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.SystemMessageResponseMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.SystemMessageType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolCall.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolCallArgs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolCallChunk.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolCallChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolCallType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessage.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageAdditionalKwargs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageArtifact.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageChunk.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageChunkAdditionalKwargs.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageChunkArtifact.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageChunkContentVariant2Item.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageChunkResponseMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageChunkStatus.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageChunkType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageContentVariant2Item.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageResponseMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageStatus.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.ToolMessageType.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.Models.UsageMetadata.g.cs
is excluded by!**/generated/**
src/libs/LangSmith/Generated/LangSmith.PromptsClient.Canvas.g.cs
is excluded by!**/generated/**
📒 Files selected for processing (1)
- src/libs/LangSmith/openapi.yaml (12 hunks)
🔇 Additional comments (2)
src/libs/LangSmith/openapi.yaml (2)
10262-10313
: LGTM! Well-structured message schemas.The message type schemas are well-designed with:
- Consistent structure across different message types
- Proper validation through required fields
- Comprehensive documentation with examples
- Support for both string and structured content
Also applies to: 14169-14248, 18607-18678
14366-14379
: LGTM! Comprehensive token usage tracking.The token usage schemas provide:
- Detailed breakdown of token usage
- Flexibility for different types of token counting
- Clear documentation with examples
- Version tracking for schema changes
Also applies to: 15453-15463, 19920-19941
type: string | ||
description: "A chunk of a tool call (e.g., as part of a stream).\n\nWhen merging ToolCallChunks (e.g., via AIMessageChunk.__add__),\nall string attributes are concatenated. Chunks are only merged if their\nvalues of `index` are equal and not None.\n\nExample:\n\n.. code-block:: python\n\n left_chunks = [ToolCallChunk(name=\"foo\", args='{\"a\":', index=0)]\n right_chunks = [ToolCallChunk(name=None, args='1}', index=0)]\n\n (\n AIMessageChunk(content=\"\", tool_call_chunks=left_chunks)\n + AIMessageChunk(content=\"\", tool_call_chunks=right_chunks)\n ).tool_call_chunks == [ToolCallChunk(name='foo', args='{\"a\":1}', index=0)]" | ||
ToolMessage: | ||
title: ToolMessage | ||
required: | ||
- content | ||
- tool_call_id | ||
type: object | ||
properties: | ||
content: | ||
title: Content | ||
anyOf: | ||
- type: string | ||
- type: array | ||
items: | ||
anyOf: | ||
- type: string | ||
- type: object | ||
additional_kwargs: | ||
title: Additional Kwargs | ||
type: object | ||
response_metadata: | ||
title: Response Metadata | ||
type: object | ||
type: | ||
title: Type | ||
enum: | ||
- tool | ||
type: string | ||
default: tool | ||
name: | ||
title: Name | ||
type: string | ||
nullable: true | ||
id: | ||
title: Id | ||
type: string | ||
nullable: true | ||
tool_call_id: | ||
title: Tool Call Id | ||
type: string | ||
artifact: | ||
title: Artifact | ||
status: | ||
title: Status | ||
enum: | ||
- success | ||
- error | ||
type: string | ||
default: success | ||
description: "Message for passing the result of executing a tool back to a model.\n\nToolMessages contain the result of a tool invocation. Typically, the result\nis encoded inside the `content` field.\n\nExample: A ToolMessage representing a result of 42 from a tool call with id\n\n .. code-block:: python\n\n from langchain_core.messages import ToolMessage\n\n ToolMessage(content='42', tool_call_id='call_Jja7J89XsjrOLA5r!MEOW!SL')\n\n\nExample: A ToolMessage where only part of the tool output is sent to the model\n and the full output is passed in to artifact.\n\n .. versionadded:: 0.2.17\n\n .. code-block:: python\n\n from langchain_core.messages import ToolMessage\n\n tool_output = {\n \"stdout\": \"From the graph we can see that the correlation between x and y is ...\",\n \"stderr\": None,\n \"artifacts\": {\"type\": \"image\", \"base64_data\": \"/9j/4gIcSU...\"},\n }\n\n ToolMessage(\n content=tool_output[\"stdout\"],\n artifact=tool_output,\n tool_call_id='call_Jja7J89XsjrOLA5r!MEOW!SL',\n )\n\nThe tool_call_id field is used to associate the tool call request with the\ntool call response. This is useful in situations where a chat model is able\nto request multiple tool calls in parallel." | ||
ToolMessageChunk: | ||
title: ToolMessageChunk | ||
required: | ||
- content | ||
- tool_call_id | ||
type: object | ||
properties: | ||
content: | ||
title: Content | ||
anyOf: | ||
- type: string | ||
- type: array | ||
items: | ||
anyOf: | ||
- type: string | ||
- type: object | ||
additional_kwargs: | ||
title: Additional Kwargs | ||
type: object | ||
response_metadata: | ||
title: Response Metadata | ||
type: object | ||
type: | ||
title: Type | ||
enum: | ||
- ToolMessageChunk | ||
type: string | ||
default: ToolMessageChunk | ||
name: | ||
title: Name | ||
type: string | ||
nullable: true | ||
id: | ||
title: Id | ||
type: string | ||
nullable: true | ||
tool_call_id: | ||
title: Tool Call Id | ||
type: string | ||
artifact: | ||
title: Artifact | ||
status: | ||
title: Status | ||
enum: | ||
- success | ||
- error | ||
type: string | ||
default: success | ||
description: Tool Message chunk. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider adding JSON schema validation for tool arguments.
While the tool-related schemas are well-designed, the args
field in ToolCall could benefit from additional validation to ensure it contains valid JSON.
Consider updating the args field definition:
args:
title: Args
type: object
+ additionalProperties: true
+ description: "JSON object containing the arguments for the tool call. Must be valid JSON."
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
ToolCall: | |
title: ToolCall | |
required: | |
- name | |
- args | |
- id | |
type: object | |
properties: | |
name: | |
title: Name | |
type: string | |
args: | |
title: Args | |
type: object | |
id: | |
title: Id | |
type: string | |
nullable: true | |
type: | |
title: Type | |
enum: | |
- tool_call | |
type: string | |
description: "Represents a request to call a tool.\n\nExample:\n\n .. code-block:: python\n\n {\n \"name\": \"foo\",\n \"args\": {\"a\": 1},\n \"id\": \"123\"\n }\n\n This represents a request to call the tool named \"foo\" with arguments {\"a\": 1}\n and an identifier of \"123\"." | |
ToolCallChunk: | |
title: ToolCallChunk | |
required: | |
- name | |
- args | |
- id | |
- index | |
type: object | |
properties: | |
name: | |
title: Name | |
type: string | |
nullable: true | |
args: | |
title: Args | |
type: string | |
nullable: true | |
id: | |
title: Id | |
type: string | |
nullable: true | |
index: | |
title: Index | |
type: integer | |
nullable: true | |
type: | |
title: Type | |
enum: | |
- tool_call_chunk | |
type: string | |
description: "A chunk of a tool call (e.g., as part of a stream).\n\nWhen merging ToolCallChunks (e.g., via AIMessageChunk.__add__),\nall string attributes are concatenated. Chunks are only merged if their\nvalues of `index` are equal and not None.\n\nExample:\n\n.. code-block:: python\n\n left_chunks = [ToolCallChunk(name=\"foo\", args='{\"a\":', index=0)]\n right_chunks = [ToolCallChunk(name=None, args='1}', index=0)]\n\n (\n AIMessageChunk(content=\"\", tool_call_chunks=left_chunks)\n + AIMessageChunk(content=\"\", tool_call_chunks=right_chunks)\n ).tool_call_chunks == [ToolCallChunk(name='foo', args='{\"a\":1}', index=0)]" | |
ToolMessage: | |
title: ToolMessage | |
required: | |
- content | |
- tool_call_id | |
type: object | |
properties: | |
content: | |
title: Content | |
anyOf: | |
- type: string | |
- type: array | |
items: | |
anyOf: | |
- type: string | |
- type: object | |
additional_kwargs: | |
title: Additional Kwargs | |
type: object | |
response_metadata: | |
title: Response Metadata | |
type: object | |
type: | |
title: Type | |
enum: | |
- tool | |
type: string | |
default: tool | |
name: | |
title: Name | |
type: string | |
nullable: true | |
id: | |
title: Id | |
type: string | |
nullable: true | |
tool_call_id: | |
title: Tool Call Id | |
type: string | |
artifact: | |
title: Artifact | |
status: | |
title: Status | |
enum: | |
- success | |
- error | |
type: string | |
default: success | |
description: "Message for passing the result of executing a tool back to a model.\n\nToolMessages contain the result of a tool invocation. Typically, the result\nis encoded inside the `content` field.\n\nExample: A ToolMessage representing a result of 42 from a tool call with id\n\n .. code-block:: python\n\n from langchain_core.messages import ToolMessage\n\n ToolMessage(content='42', tool_call_id='call_Jja7J89XsjrOLA5r!MEOW!SL')\n\n\nExample: A ToolMessage where only part of the tool output is sent to the model\n and the full output is passed in to artifact.\n\n .. versionadded:: 0.2.17\n\n .. code-block:: python\n\n from langchain_core.messages import ToolMessage\n\n tool_output = {\n \"stdout\": \"From the graph we can see that the correlation between x and y is ...\",\n \"stderr\": None,\n \"artifacts\": {\"type\": \"image\", \"base64_data\": \"/9j/4gIcSU...\"},\n }\n\n ToolMessage(\n content=tool_output[\"stdout\"],\n artifact=tool_output,\n tool_call_id='call_Jja7J89XsjrOLA5r!MEOW!SL',\n )\n\nThe tool_call_id field is used to associate the tool call request with the\ntool call response. This is useful in situations where a chat model is able\nto request multiple tool calls in parallel." | |
ToolMessageChunk: | |
title: ToolMessageChunk | |
required: | |
- content | |
- tool_call_id | |
type: object | |
properties: | |
content: | |
title: Content | |
anyOf: | |
- type: string | |
- type: array | |
items: | |
anyOf: | |
- type: string | |
- type: object | |
additional_kwargs: | |
title: Additional Kwargs | |
type: object | |
response_metadata: | |
title: Response Metadata | |
type: object | |
type: | |
title: Type | |
enum: | |
- ToolMessageChunk | |
type: string | |
default: ToolMessageChunk | |
name: | |
title: Name | |
type: string | |
nullable: true | |
id: | |
title: Id | |
type: string | |
nullable: true | |
tool_call_id: | |
title: Tool Call Id | |
type: string | |
artifact: | |
title: Artifact | |
status: | |
title: Status | |
enum: | |
- success | |
- error | |
type: string | |
default: success | |
description: Tool Message chunk. | |
ToolCall: | |
title: ToolCall | |
required: | |
- name | |
- args | |
- id | |
type: object | |
properties: | |
name: | |
title: Name | |
type: string | |
args: | |
title: Args | |
type: object | |
additionalProperties: true | |
description: "JSON object containing the arguments for the tool call. Must be valid JSON." | |
id: | |
title: Id | |
type: string | |
nullable: true | |
type: | |
title: Type | |
enum: | |
- tool_call | |
type: string | |
description: "Represents a request to call a tool.\n\nExample:\n\n .. code-block:: python\n\n {\n \"name\": \"foo\",\n \"args\": {\"a\": 1},\n \"id\": \"123\"\n }\n\n This represents a request to call the tool named \"foo\" with arguments {\"a\": 1}\n and an identifier of \"123\"." | |
ToolCallChunk: | |
title: ToolCallChunk | |
required: | |
- name | |
- args | |
- id | |
- index | |
type: object | |
properties: | |
name: | |
title: Name | |
type: string | |
nullable: true | |
args: | |
title: Args | |
type: string | |
nullable: true | |
id: | |
title: Id | |
type: string | |
nullable: true | |
index: | |
title: Index | |
type: integer | |
nullable: true | |
type: | |
title: Type | |
enum: | |
- tool_call_chunk | |
type: string | |
description: "A chunk of a tool call (e.g., as part of a stream).\n\nWhen merging ToolCallChunks (e.g., via AIMessageChunk.__add__),\nall string attributes are concatenated. Chunks are only merged if their\nvalues of `index` are equal and not None.\n\nExample:\n\n.. code-block:: python\n\n left_chunks = [ToolCallChunk(name=\"foo\", args='{\"a\":', index=0)]\n right_chunks = [ToolCallChunk(name=None, args='1}', index=0)]\n\n (\n AIMessageChunk(content=\"\", tool_call_chunks=left_chunks)\n + AIMessageChunk(content=\"\", tool_call_chunks=right_chunks)\n ).tool_call_chunks == [ToolCallChunk(name='foo', args='{\"a\":1}', index=0)]" | |
ToolMessage: | |
title: ToolMessage | |
required: | |
- content | |
- tool_call_id | |
type: object | |
properties: | |
content: | |
title: Content | |
anyOf: | |
- type: string | |
- type: array | |
items: | |
anyOf: | |
- type: string | |
- type: object | |
additional_kwargs: | |
title: Additional Kwargs | |
type: object | |
response_metadata: | |
title: Response Metadata | |
type: object | |
type: | |
title: Type | |
enum: | |
- tool | |
type: string | |
default: tool | |
name: | |
title: Name | |
type: string | |
nullable: true | |
id: | |
title: Id | |
type: string | |
nullable: true | |
tool_call_id: | |
title: Tool Call Id | |
type: string | |
artifact: | |
title: Artifact | |
status: | |
title: Status | |
enum: | |
- success | |
- error | |
type: string | |
default: success | |
description: "Message for passing the result of executing a tool back to a model.\n\nToolMessages contain the result of a tool invocation. Typically, the result\nis encoded inside the `content` field.\n\nExample: A ToolMessage representing a result of 42 from a tool call with id\n\n .. code-block:: python\n\n from langchain_core.messages import ToolMessage\n\n ToolMessage(content='42', tool_call_id='call_Jja7J89XsjrOLA5r!MEOW!SL')\n\n\nExample: A ToolMessage where only part of the tool output is sent to the model\n and the full output is passed in to artifact.\n\n .. versionadded:: 0.2.17\n\n .. code-block:: python\n\n from langchain_core.messages import ToolMessage\n\n tool_output = {\n \"stdout\": \"From the graph we can see that the correlation between x and y is ...\",\n \"stderr\": None,\n \"artifacts\": {\"type\": \"image\", \"base64_data\": \"/9j/4gIcSU...\"},\n }\n\n ToolMessage(\n content=tool_output[\"stdout\"],\n artifact=tool_output,\n tool_call_id='call_Jja7J89XsjrOLA5r!MEOW!SL',\n )\n\nThe tool_call_id field is used to associate the tool call request with the\ntool call response. This is useful in situations where a chat model is able\nto request multiple tool calls in parallel." | |
ToolMessageChunk: | |
title: ToolMessageChunk | |
required: | |
- content | |
- tool_call_id | |
type: object | |
properties: | |
content: | |
title: Content | |
anyOf: | |
- type: string | |
- type: array | |
items: | |
anyOf: | |
- type: string | |
- type: object | |
additional_kwargs: | |
title: Additional Kwargs | |
type: object | |
response_metadata: | |
title: Response Metadata | |
type: object | |
type: | |
title: Type | |
enum: | |
- ToolMessageChunk | |
type: string | |
default: ToolMessageChunk | |
name: | |
title: Name | |
type: string | |
nullable: true | |
id: | |
title: Id | |
type: string | |
nullable: true | |
tool_call_id: | |
title: Tool Call Id | |
type: string | |
artifact: | |
title: Artifact | |
status: | |
title: Status | |
enum: | |
- success | |
- error | |
type: string | |
default: success | |
description: Tool Message chunk. |
Summary by CodeRabbit
New Features
Improvements
Miscellaneous