openapi: 3.1.0 info: title: LangSmith access_policies prompts API description: 'The LangSmith API is used to programmatically create and manage LangSmith resources. ## Host https://api.smith.langchain.com ## Authentication To authenticate with the LangSmith API, set the `X-Api-Key` header to a valid [LangSmith API key](https://docs.langchain.com/langsmith/create-account-api-key#create-an-api-key). ' version: 0.1.0 servers: - url: / tags: - name: prompts paths: /api/v1/prompts/invoke_prompt: post: tags: - prompts summary: Invoke Prompt operationId: invoke_prompt_api_v1_prompts_invoke_prompt_post requestBody: content: application/json: schema: $ref: '#/components/schemas/InvokePromptPayload' required: true responses: '200': description: Successful Response content: application/json: schema: {} '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/v1/prompts/canvas: post: tags: - prompts summary: Prompt Canvas operationId: prompt_canvas_api_v1_prompts_canvas_post requestBody: content: application/json: schema: $ref: '#/components/schemas/PlaygroundPromptCanvasPayload' required: true responses: '200': description: Successful Response content: application/json: schema: {} '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' security: - API Key: [] - Tenant ID: [] - Bearer Auth: [] components: schemas: ChatMessageChunk: properties: content: anyOf: - type: string - items: anyOf: - type: string - additionalProperties: true type: object type: array title: Content additional_kwargs: additionalProperties: true type: object title: Additional Kwargs response_metadata: additionalProperties: true type: object title: Response Metadata type: type: string const: ChatMessageChunk title: Type default: ChatMessageChunk name: anyOf: - type: string - type: 'null' title: Name id: anyOf: - type: string - type: 'null' title: Id role: type: string title: Role additionalProperties: true type: object required: - content - role title: ChatMessageChunk description: Chat Message chunk. ValidationError: properties: loc: items: anyOf: - type: string - type: integer type: array title: Location msg: type: string title: Message type: type: string title: Error Type type: object required: - loc - msg - type title: ValidationError AIMessageChunk: properties: content: anyOf: - type: string - items: anyOf: - type: string - additionalProperties: true type: object type: array title: Content additional_kwargs: additionalProperties: true type: object title: Additional Kwargs response_metadata: additionalProperties: true type: object title: Response Metadata type: type: string const: AIMessageChunk title: Type default: AIMessageChunk name: anyOf: - type: string - type: 'null' title: Name id: anyOf: - type: string - type: 'null' title: Id tool_calls: items: $ref: '#/components/schemas/ToolCall' type: array title: Tool Calls invalid_tool_calls: items: $ref: '#/components/schemas/InvalidToolCall' type: array title: Invalid Tool Calls usage_metadata: anyOf: - $ref: '#/components/schemas/UsageMetadata' - type: 'null' tool_call_chunks: items: $ref: '#/components/schemas/ToolCallChunk' type: array title: Tool Call Chunks chunk_position: anyOf: - type: string const: last - type: 'null' title: Chunk Position additionalProperties: true type: object required: - content title: AIMessageChunk description: Message chunk from an AI (yielded when streaming). FunctionMessage: properties: content: anyOf: - type: string - items: anyOf: - type: string - additionalProperties: true type: object type: array title: Content additional_kwargs: additionalProperties: true type: object title: Additional Kwargs response_metadata: additionalProperties: true type: object title: Response Metadata type: type: string const: function title: Type default: function name: type: string title: Name id: anyOf: - type: string - type: 'null' title: Id additionalProperties: true type: object required: - content - name title: FunctionMessage description: 'Message for passing the result of executing a tool back to a model. `FunctionMessage` are an older version of the `ToolMessage` schema, and do not contain the `tool_call_id` field. The `tool_call_id` field is used to associate the tool call request with the tool call response. Useful in situations where a chat model is able to request multiple tool calls in parallel.' ToolMessage: properties: content: anyOf: - type: string - items: anyOf: - type: string - additionalProperties: true type: object type: array title: Content additional_kwargs: additionalProperties: true type: object title: Additional Kwargs response_metadata: additionalProperties: true type: object title: Response Metadata type: type: string const: tool title: Type default: tool name: anyOf: - type: string - type: 'null' title: Name id: anyOf: - type: string - type: 'null' title: Id tool_call_id: type: string title: Tool Call Id artifact: title: Artifact status: type: string enum: - success - error title: Status default: success additionalProperties: true type: object required: - content - tool_call_id title: ToolMessage description: "Message for passing the result of executing a tool back to a model.\n\n`ToolMessage` objects contain the result of a tool invocation. Typically, the result\nis encoded inside the `content` field.\n\n`tool_call_id` is used to associate the tool call request with the tool call\nresponse. Useful in situations where a chat model is able to request multiple tool\ncalls in parallel.\n\nExample:\n A `ToolMessage` representing a result of `42` from a tool call with id\n\n ```python\n from langchain_core.messages import ToolMessage\n\n ToolMessage(content=\"42\", tool_call_id=\"call_Jja7J89XsjrOLA5r!MEOW!SL\")\n ```\n\nExample:\n 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 ```python\n from langchain_core.messages import ToolMessage\n\n tool_output = {\n \"stdout\": \"From the graph we can see that the correlation between \"\n \"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 ```" OutputTokenDetails: properties: audio: type: integer title: Audio reasoning: type: integer title: Reasoning type: object title: OutputTokenDetails description: "Breakdown of output token counts.\n\nDoes *not* need to sum to full output token count. Does *not* need to have all keys.\n\nExample:\n ```python\n {\n \"audio\": 10,\n \"reasoning\": 200,\n }\n ```\n\nMay also hold extra provider-specific keys.\n\n!!! version-added \"Added in `langchain-core` 0.3.9\"" ChatMessage: properties: content: anyOf: - type: string - items: anyOf: - type: string - additionalProperties: true type: object type: array title: Content additional_kwargs: additionalProperties: true type: object title: Additional Kwargs response_metadata: additionalProperties: true type: object title: Response Metadata type: type: string const: chat title: Type default: chat name: anyOf: - type: string - type: 'null' title: Name id: anyOf: - type: string - type: 'null' title: Id role: type: string title: Role additionalProperties: true type: object required: - content - role title: ChatMessage description: Message that can be assigned an arbitrary speaker (i.e. role). HumanMessage: properties: content: anyOf: - type: string - items: anyOf: - type: string - additionalProperties: true type: object type: array title: Content additional_kwargs: additionalProperties: true type: object title: Additional Kwargs response_metadata: additionalProperties: true type: object title: Response Metadata type: type: string const: human title: Type default: human name: anyOf: - type: string - type: 'null' title: Name id: anyOf: - type: string - type: 'null' title: Id additionalProperties: true type: object required: - content title: HumanMessage description: "Message from the user.\n\nA `HumanMessage` is a message that is passed in from a user to the model.\n\nExample:\n ```python\n from langchain_core.messages import HumanMessage, SystemMessage\n\n messages = [\n SystemMessage(content=\"You are a helpful assistant! Your name is Bob.\"),\n HumanMessage(content=\"What is your name?\"),\n ]\n\n # Instantiate a chat model and invoke it with the messages\n model = ...\n print(model.invoke(messages))\n ```" HTTPValidationError: properties: detail: items: $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object title: HTTPValidationError ToolCallChunk: properties: name: anyOf: - type: string - type: 'null' title: Name args: anyOf: - type: string - type: 'null' title: Args id: anyOf: - type: string - type: 'null' title: Id index: anyOf: - type: integer - type: 'null' title: Index type: type: string const: tool_call_chunk title: Type type: object required: - name - args - id - index title: ToolCallChunk description: "A chunk of a tool call (yielded when streaming).\n\nWhen merging `ToolCallChunk` objects (e.g., via `AIMessageChunk.__add__`), all\nstring attributes are concatenated. Chunks are only merged if their values of\n`index` are equal and not `None`.\n\nExample:\n```python\nleft_chunks = [ToolCallChunk(name=\"foo\", args='{\"a\":', index=0)]\nright_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)]\n```" SystemMessage: properties: content: anyOf: - type: string - items: anyOf: - type: string - additionalProperties: true type: object type: array title: Content additional_kwargs: additionalProperties: true type: object title: Additional Kwargs response_metadata: additionalProperties: true type: object title: Response Metadata type: type: string const: system title: Type default: system name: anyOf: - type: string - type: 'null' title: Name id: anyOf: - type: string - type: 'null' title: Id additionalProperties: true type: object required: - content title: SystemMessage description: "Message for priming AI behavior.\n\nThe system message is usually passed in as the first of a sequence\nof input messages.\n\nExample:\n ```python\n from langchain_core.messages import HumanMessage, SystemMessage\n\n messages = [\n SystemMessage(content=\"You are a helpful assistant! Your name is Bob.\"),\n HumanMessage(content=\"What is your name?\"),\n ]\n\n # Define a chat model and invoke it with the messages\n print(model.invoke(messages))\n ```" UsageMetadata: properties: input_tokens: type: integer title: Input Tokens output_tokens: type: integer title: Output Tokens total_tokens: type: integer title: Total Tokens input_token_details: $ref: '#/components/schemas/InputTokenDetails' output_token_details: $ref: '#/components/schemas/OutputTokenDetails' type: object required: - input_tokens - output_tokens - total_tokens title: UsageMetadata description: "Usage metadata for a message, such as token counts.\n\nThis is a standard representation of token usage that is consistent across models.\n\nExample:\n ```python\n {\n \"input_tokens\": 350,\n \"output_tokens\": 240,\n \"total_tokens\": 590,\n \"input_token_details\": {\n \"audio\": 10,\n \"cache_creation\": 200,\n \"cache_read\": 100,\n },\n \"output_token_details\": {\n \"audio\": 10,\n \"reasoning\": 200,\n },\n }\n ```\n\n!!! warning \"Behavior changed in `langchain-core` 0.3.9\"\n\n Added `input_token_details` and `output_token_details`.\n\n!!! note \"LangSmith SDK\"\n\n The LangSmith SDK also has a `UsageMetadata` class. While the two share fields,\n LangSmith's `UsageMetadata` has additional fields to capture cost information\n used by the LangSmith platform." Highlight: properties: prompt_chunk_start_index: type: integer title: Prompt Chunk Start Index prompt_chunk_end_index: type: integer title: Prompt Chunk End Index prompt_chunk: type: string title: Prompt Chunk highlight_text: type: string title: Highlight Text type: object required: - prompt_chunk_start_index - prompt_chunk_end_index - prompt_chunk - highlight_text title: Highlight SystemMessageChunk: properties: content: anyOf: - type: string - items: anyOf: - type: string - additionalProperties: true type: object type: array title: Content additional_kwargs: additionalProperties: true type: object title: Additional Kwargs response_metadata: additionalProperties: true type: object title: Response Metadata type: type: string const: SystemMessageChunk title: Type default: SystemMessageChunk name: anyOf: - type: string - type: 'null' title: Name id: anyOf: - type: string - type: 'null' title: Id additionalProperties: true type: object required: - content title: SystemMessageChunk description: System Message chunk. Artifact: properties: id: type: string title: Id contents: items: $ref: '#/components/schemas/ArtifactContent' type: array title: Contents current_content_index: type: integer title: Current Content Index type: object required: - id - contents - current_content_index title: Artifact HumanMessageChunk: properties: content: anyOf: - type: string - items: anyOf: - type: string - additionalProperties: true type: object type: array title: Content additional_kwargs: additionalProperties: true type: object title: Additional Kwargs response_metadata: additionalProperties: true type: object title: Response Metadata type: type: string const: HumanMessageChunk title: Type default: HumanMessageChunk name: anyOf: - type: string - type: 'null' title: Name id: anyOf: - type: string - type: 'null' title: Id additionalProperties: true type: object required: - content title: HumanMessageChunk description: Human Message chunk. InputTokenDetails: properties: audio: type: integer title: Audio cache_creation: type: integer title: Cache Creation cache_read: type: integer title: Cache Read type: object title: InputTokenDetails description: "Breakdown of input token counts.\n\nDoes *not* need to sum to full input token count. Does *not* need to have all keys.\n\nExample:\n ```python\n {\n \"audio\": 10,\n \"cache_creation\": 200,\n \"cache_read\": 100,\n }\n ```\n\nMay also hold extra provider-specific keys.\n\n!!! version-added \"Added in `langchain-core` 0.3.9\"" ToolMessageChunk: properties: content: anyOf: - type: string - items: anyOf: - type: string - additionalProperties: true type: object type: array title: Content additional_kwargs: additionalProperties: true type: object title: Additional Kwargs response_metadata: additionalProperties: true type: object title: Response Metadata type: type: string const: ToolMessageChunk title: Type default: ToolMessageChunk name: anyOf: - type: string - type: 'null' title: Name id: anyOf: - type: string - type: 'null' title: Id tool_call_id: type: string title: Tool Call Id artifact: title: Artifact status: type: string enum: - success - error title: Status default: success additionalProperties: true type: object required: - content - tool_call_id title: ToolMessageChunk description: Tool Message chunk. InvokePromptPayload: properties: messages: items: prefixItems: - type: string - type: string type: array maxItems: 2 minItems: 2 type: array title: Messages template_format: type: string title: Template Format inputs: additionalProperties: true type: object title: Inputs type: object required: - messages - template_format - inputs title: InvokePromptPayload PlaygroundPromptCanvasPayload: properties: messages: items: oneOf: - $ref: '#/components/schemas/AIMessage' - $ref: '#/components/schemas/HumanMessage' - $ref: '#/components/schemas/ChatMessage' - $ref: '#/components/schemas/SystemMessage' - $ref: '#/components/schemas/FunctionMessage' - $ref: '#/components/schemas/ToolMessage' - $ref: '#/components/schemas/AIMessageChunk' - $ref: '#/components/schemas/HumanMessageChunk' - $ref: '#/components/schemas/ChatMessageChunk' - $ref: '#/components/schemas/SystemMessageChunk' - $ref: '#/components/schemas/FunctionMessageChunk' - $ref: '#/components/schemas/ToolMessageChunk' type: array title: Messages highlighted: anyOf: - $ref: '#/components/schemas/Highlight' - type: 'null' artifact: anyOf: - $ref: '#/components/schemas/Artifact' - type: 'null' artifact_length: anyOf: - type: string enum: - shortest - short - long - longest - type: 'null' title: Artifact Length reading_level: anyOf: - type: string enum: - child - teenager - college - phd - type: 'null' title: Reading Level custom_action: anyOf: - type: string - type: 'null' title: Custom Action template_format: type: string enum: - f-string - mustache title: Template Format secrets: additionalProperties: type: string type: object title: Secrets type: object required: - messages - template_format - secrets title: PlaygroundPromptCanvasPayload AIMessage: properties: content: anyOf: - type: string - items: anyOf: - type: string - additionalProperties: true type: object type: array title: Content additional_kwargs: additionalProperties: true type: object title: Additional Kwargs response_metadata: additionalProperties: true type: object title: Response Metadata type: type: string const: ai title: Type default: ai name: anyOf: - type: string - type: 'null' title: Name id: anyOf: - type: string - type: 'null' title: Id tool_calls: items: $ref: '#/components/schemas/ToolCall' type: array title: Tool Calls invalid_tool_calls: items: $ref: '#/components/schemas/InvalidToolCall' type: array title: Invalid Tool Calls usage_metadata: anyOf: - $ref: '#/components/schemas/UsageMetadata' - type: 'null' additionalProperties: true type: object required: - content title: AIMessage description: 'Message from an AI. An `AIMessage` is returned from a chat model as a response to a prompt. This message represents the output of the model and consists of both the raw output as returned by the model and standardized fields (e.g., tool calls, usage metadata) added by the LangChain framework.' ArtifactContent: properties: index: type: integer title: Index content: type: string title: Content type: object required: - index - content title: ArtifactContent FunctionMessageChunk: properties: content: anyOf: - type: string - items: anyOf: - type: string - additionalProperties: true type: object type: array title: Content additional_kwargs: additionalProperties: true type: object title: Additional Kwargs response_metadata: additionalProperties: true type: object title: Response Metadata type: type: string const: FunctionMessageChunk title: Type default: FunctionMessageChunk name: type: string title: Name id: anyOf: - type: string - type: 'null' title: Id additionalProperties: true type: object required: - content - name title: FunctionMessageChunk description: Function Message chunk. InvalidToolCall: properties: type: type: string const: invalid_tool_call title: Type id: anyOf: - type: string - type: 'null' title: Id name: anyOf: - type: string - type: 'null' title: Name args: anyOf: - type: string - type: 'null' title: Args error: anyOf: - type: string - type: 'null' title: Error index: anyOf: - type: integer - type: string title: Index extras: additionalProperties: true type: object title: Extras type: object required: - type - id - name - args - error title: InvalidToolCall description: 'Allowance for errors made by LLM. Here we add an `error` key to surface errors made during generation (e.g., invalid JSON arguments.)' ToolCall: properties: name: type: string title: Name args: additionalProperties: true type: object title: Args id: anyOf: - type: string - type: 'null' title: Id type: type: string const: tool_call title: Type type: object required: - name - args - id title: ToolCall description: "Represents an AI's request to call a tool.\n\nExample:\n ```python\n {\"name\": \"foo\", \"args\": {\"a\": 1}, \"id\": \"123\"}\n ```\n\n This represents a request to call the tool named `'foo'` with arguments\n `{\"a\": 1}` and an identifier of `'123'`.\n\n!!! note \"Factory function\"\n\n `tool_call` may also be used as a factory to create a `ToolCall`. Benefits\n include:\n\n * Required arguments strictly validated at creation time" securitySchemes: API Key: type: apiKey in: header name: X-API-Key Tenant ID: type: apiKey in: header name: X-Tenant-Id Bearer Auth: type: http description: Bearer tokens are used to authenticate from the UI. Must also specify x-tenant-id or x-organization-id (for org scoped apis). scheme: bearer Organization ID: type: apiKey in: header name: X-Organization-Id