id
stringlengths
6
6
text
stringlengths
20
17.2k
title
stringclasses
1 value
127924
/**************************************************************************/ /* scene_multiplayer.h */ /**************************************************************************/ /* This file is part of: */ /* ...
127925
/**************************************************************************/ /* multiplayer_synchronizer.h */ /**************************************************************************/ /* This file is part of: */ /* ...
127926
/**************************************************************************/ /* scene_replication_interface.h */ /**************************************************************************/ /* This file is part of: */ /* ...
127932
<?xml version="1.0" encoding="UTF-8" ?> <class name="MultiplayerSynchronizer" inherits="Node" keywords="network" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> <brief_description> Synchronizes properties from the multiplayer authority to the remote peers...
127933
<?xml version="1.0" encoding="UTF-8" ?> <class name="MultiplayerSpawner" inherits="Node" keywords="network" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> <brief_description> Automatically replicates spawnable nodes from the authority to other multiplaye...
127935
<?xml version="1.0" encoding="UTF-8" ?> <class name="SceneMultiplayer" inherits="MultiplayerAPI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> <brief_description> High-level multiplayer API implementation. </brief_description> <description> This cla...
128130
void canvas_item_set_clip(RID p_item, bool p_clip); void canvas_item_set_distance_field_mode(RID p_item, bool p_enable); void canvas_item_set_custom_rect(RID p_item, bool p_custom_rect, const Rect2 &p_rect = Rect2()); void canvas_item_set_modulate(RID p_item, const Color &p_color); void canvas_item_set_self_modulat...
130896
inline static void XrQuaternionf_Multiply(XrQuaternionf* result, const XrQuaternionf* a, const XrQuaternionf* b) { result->x = (b->w * a->x) + (b->x * a->w) + (b->y * a->z) - (b->z * a->y); result->y = (b->w * a->y) - (b->x * a->z) + (b->y * a->w) + (b->z * a->x); result->z = (b->w * a->z) + (b->x * a->y) -...
132104
// Copyright 2009-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 #pragma once #include "vec3.h" #include "vec4.h" #include "transcendental.h" namespace embree { //////////////////////////////////////////////////////////////// // Quaternion Struct ////////////////////////////////////////////////...
138427
inline void rcVcross(float* dest, const float* v1, const float* v2) { dest[0] = v1[1]*v2[2] - v1[2]*v2[1]; dest[1] = v1[2]*v2[0] - v1[0]*v2[2]; dest[2] = v1[0]*v2[1] - v1[1]*v2[0]; } /// Derives the dot product of two vectors. (@p v1 . @p v2) /// @param[in] v1 A Vector [(x, y, z)] /// @param[in] v2 A vector [(x, ...
138454
namespace VHACD { // -- GODOT end -- /**@brief btVector3 can be used to represent 3D points and vectors. * It has an un-used w component to suit 16-byte alignment when btVector3 is stored in containers. This extra component can be used by derived classes (Quaternion?) or by user * Ideally, this class should be repla...
138456
operator*(const btVector3& v, const btScalar& s) { return btVector3(v.m_floats[0] * s, v.m_floats[1] * s, v.m_floats[2] * s); } /**@brief Return the vector scaled by s */ SIMD_FORCE_INLINE btVector3 operator*(const btScalar& s, const btVector3& v) { return v * s; } /**@brief Return the vector inversely scaled...
138484
void fm_catmullRom(REAL *out_vector,const REAL *p1,const REAL *p2,const REAL *p3,const REAL *p4, const REAL s) { REAL s_squared = s * s; REAL s_cubed = s_squared * s; REAL coefficient_p1 = -s_cubed + 2*s_squared - s; REAL coefficient_p2 = 3 * s_cubed - 5 * s_squared + 2; REAL coefficient_p3 = -3 * s_cubed +4...
138566
float get_scanning_progress() const; void scan(); void scan_changes(); void update_file(const String &p_file); void update_files(const Vector<String> &p_script_paths); HashSet<String> get_valid_extensions() const; void register_global_class_script(const String &p_search_path, const String &p_target_path); Edito...
138632
/**************************************************************************/ /* import_defaults_editor.h */ /**************************************************************************/ /* This file is part of: */ /* ...
139816
/**************************************************************************/ /* editor_import_plugin.h */ /**************************************************************************/ /* This file is part of: */ /* ...
139933
defaults: 4: templates: export_templates.tpz editor: android.apk: android_editor.apk android.horizonos: android_editor_horizonos.apk linux.64: linux.x86_64.zip linux.32: linux.x86_32.zip linux.arm64: linux.arm64.zip linux.arm32: linux.arm32.zip macos.universal: macos....
139998
# New asset workflow Godot 3.0 has changed how the assets pipeline work. We now use the more familiar scheme of automatically importing assets. Simply drop an asset into the project folder and it will automatically be imported with configurable default parameters. Options can be changed afterwards after importing. ![...
140003
--- title: "Maintenance release: Godot 4.2.1" excerpt: "This first maintenance release fixes a number of platform compatibility issues introduced in Godot 4.2, which should make it much easier to upgrade from 4.1 or start new projects on all platforms." categories: ["release"] author: Rémi Verschelde image: /storage/bl...
140049
### Make rendering always happen in Linear colorspace Texture and color information edited by users exists only in the SRGB colorspace. This happens because monitor colors are adjusted by a Gamma function, elevating them to a roughly 2.2 or 2.4 power. To make lighting more realistic, all computations must happen in a...
140098
--- title: "GDScript progress report: New GDScript is now merged" excerpt: "New GDScript code is now merged. Here I talk a bit of what has changed, report what else I did this month and talk a bit about my current work and plans for the future." categories: ["progress-report"] author: George Marques image: /storage/app...
140131
articles/download_card.html version="4.2" release="beta1" article=page %} **Standard build** includes support for GDScript and GDExtension. **.NET build** (marked as `mono`) includes support for C#, as well as GDScript and GDExtension. - .NET build requires [.NET SDK 6.0](https://dotnet.microsoft.com/en-us/download/d...
140175
--- title: "Web Editor beta, AudioWorklet, GDNative and more!" excerpt: "The Web Editor reaches beta (3.2.4 beta 4), GDNative lands on the web, thread-enabled HTML5 builds now come with an improved audio driver using the AudioWorklet API." categories: ["progress-report"] author: Fabio Alessandrelli image: /storage/app/...
140206
--- title: "Basic cryptography, SSL improvements" excerpt: "As part of the MOSS project sponsored by Mozilla, during July I worked on some new features regarding cryptography and SSL to improve the quality and security of Godot networking." categories: ["progress-report"] author: Fabio Alessandrelli image: /storage/app...
140305
# Downloads {% include articles/download_card.html version="4.1.4" release="rc3" article=page %} **Standard build** includes support for GDScript and GDExtension. **.NET 6 build** (marked as `mono`) includes support for C#, as well as GDScript and GDExtension. - .NET build requires [.NET SDK 6.0](https://dotnet.micr...
140318
Solution ### Preparation Solving the problems identified above does not actually require the introduction of an acyclic graph: inserting synchronization barriers and performing dependency tracking is entirely possible without applying this technique. This was actually debated internally for a while, but it was determ...
140323
# How to make a custom SkeletonModifier3D? `SkeletonModifier3D` is a virtual class, so you can't add it as stand alone node to a scene. ![add skeleton modifier](/storage/blog/design-of-the-skeleton-modifier-3d/add_skeleton_modifier.webp) Then, how do we create a custom `SkeletonModifier3D`? Let's try to create a sim...
140351
--- title: "Multiplayer in Godot 4.0: Scene Replication (part 1)" excerpt: "The long-awaited first post about the multiplayer replication system in development for Godot 4.0 is here! Check out the design goals, concepts, initial prototype, and as always, stay tuned for more!" categories: ["progress-report"] author: Fab...
140377
--- title: "Godot Engine reaches 2.0 stable" excerpt: "Godot 2.0 is out! This release is special because our team has grown a lot. We have more regular contributors, a documentation team, a bug triage team and a much larger community! Godot keeps growing and becoming more and more awesome." categories: ["release"] auth...
140412
cripting <a id="gdscript"></a> ### GDScript With **GDScript** being the most used language among current Godot users, we wanted to really improve the coding experience in Godot 4 with some of the most requested language features. You will find the static typing system is now more robust with no cyclic dependency err...
140414
nalization <a id="extended-language-support"></a> ### Extended Language Support Localization is probably the most straightforward way to allow more people to experience your game or use your tool efficiently. As a tool itself, Godot 4.0 is the first to benefit from the new added support for bidirectional text and fon...
140437
Editor <a id="node-copypaste"></a> #### Node copy-pasting Being able to easily cut/copy and paste nodes sounds like a basic feature to have, but it is only now that it [could finally be implemented in a reliable way](https://github.com/godotengine/godot/pull/34892), thanks to the hard work of Tomasz Chabora ([KoBeWi]...
140466
--- title: "Core refactoring progress report #2" excerpt: "As promised in my previous post, the core refactoring work I am undertaking took two months to complete. This means rewriting large parts of the core engine for consistency and features." categories: ["progress-report"] author: Juan Linietsky image: /storage/ap...
140473
--- title: "Current state of C# platform support in Godot 4.2" excerpt: "How the transition to a unified .NET has impacted platform support, and re-adding the ability to port to mobile." categories: ["progress-report"] author: Raul Santos image: /storage/blog/covers/progress-update-csharp-2.webp date: 2024-01-26 17:00:...
140487
--- title: "Web Export in 4.3" excerpt: "With single-threaded builds and sample playback, it's now easier than ever to export your game to the Web with Godot 4.3. And more!" categories: ["progress-report"] author: Adam Scott image: /storage/blog/covers/progress-report-web-export-in-4-3.webp image_caption_title: "Catbur...
140488
odot 4.3 Making games for the Web using Godot 4.x still isn't as seamless as we would like it to be. Unfortunately serious revisions are needed to improve the experience to the extent that we want. Godot 4.3 promises to be one of the best recent releases for Web exports. One of the biggest issues relating to this has ...
140553
--- title: "Dev snapshot: Godot 3.0 alpha 2" excerpt: "One step closer to the release of Godot 3.0! With this alpha 2 development snapshot, Godot users will be able to preview the upcoming C# support and continue testing the advanced 3D features introduced in Godot 3.0. This snapshot is of course expected to be buggy a...
140561
## Downloads {% include articles/download_card.html version="4.1.4" release="rc2" article=page %} **Standard build** includes support for GDScript and GDExtension. **.NET 6 build** (marked as `mono`) includes support for C#, as well as GDScript and GDExtension. - .NET build requires [.NET SDK 6.0](https://dotnet.mic...
140610
--- title: "Godot 3.1 will get many improvements to KinematicBody" excerpt: "One of the features that make Godot stand out is how easy it is to use the physics engine for non-physics games. For Godot 3.1, several improvements are being worked on." categories: ["progress-report"] author: Juan Linietsky image: /storage/a...
140616
--- title: "Godot 3.0 switches to Bullet for physics" excerpt: "When Godot started (a decade ago), there were not many good physics engine available and Godot always had quite demanding API requirements for them (such as Area nodes, KinematicBody, RayCast shapes, etc.), so they were not usable without a lot of modifica...
140622
new Variant type Previous versions of C# in Godot have used `System.Object` to represent Godot's Variant type, which is a special container for various data types supported by the engine. The problem with that is that `System.Object` is the base type for all .NET types, including types that are not supported by Godot....
140623
and Float changes In Godot API the names `INT` and `FLOAT` are used to mean 64-bit integer and floating types, respectively. This is true even in Godot 3, but in C# we used to marshal those types as 32-bit C# types `int` and `float`. This led to [marshaling issues](https://github.com/godotengine/godot/issues/39609) an...
140625
ure Some features didn't make it in time for Godot 4.0, but are already on our roadmap for a future release (and some are already in the works). ### Global classes Global classes, also known as named scripts, are classes registered in the editor so they can be used more conveniently. These classes appear in the _Add...
140649
--- title: "Multiplayer in Godot 4.0: RPC syntax, channels, ordering" excerpt: "New RPC syntax and features in Godot 4.0. Introducing channels and ordered transfer mode." categories: ["progress-report"] author: Fabio Alessandrelli image: /storage/app/uploads/public/615/766/117/6157661176579529840022.png date: 2021-09-2...
140665
cs and navigation {#physics} Godot 4 marks a big return of Godot's in-house 3D physics engine, **Godot Physics**. For years, Godot has relied on the **Bullet** engine to provide a solid foundation for your 3D projects. We felt, however, that a bespoke solution would give us more flexibility when implementing new featu...
140794
ing} ### GDScript {#gdscript} With **GDScript** being the most used language among current Godot users, we wanted to really improve the coding experience in Godot 4 with some of the most requested and long-awaited language features. You can now reap the benefits of first-class functions and lambdas, new property synt...
140833
--- title: "Agile input processing is here for smoother, more responsive gameplay" excerpt: "" categories: ["progress-report"] author: Pedro J. Estébanez image: /storage/app/uploads/public/612/136/3cc/6121363ccb95e735957693.png date: 2021-08-21 17:00:00 --- Since it's not very usual I post here, let me remind you who ...
140860
--- title: "Godot gets CSG support" excerpt: "After years of discussion on how to implement CSG, Godot finally gets suport for it. This implementation is simple, but makes use of Godot's amazing architecture to shine." categories: ["progress-report"] author: Juan Linietsky image: /storage/app/uploads/public/5ae/4d0/8c6...
140938
--- title: "GDScript progress report: Writing a new parser" excerpt: "Showing the work for the new GDScript parser, why it is done and how it improves over the old one. Also show a bit of new features." categories: ["progress-report"] author: George Marques image: /storage/app/uploads/public/5ed/43c/e24/5ed43ce245f1021...
140957
2D: Fix UV editor not using texture transform ([GH-84076](https://github.com/godotengine/godot/pull/84076)). - 2D: Fix generating terrain icon with certain image formats ([GH-84507](https://github.com/godotengine/godot/pull/84507)). - 2D: Keep scene tiles even if the TileMap is invisible ([GH-85753](https://github.com/...
140975
--- title: "Multiplayer in Godot 4.0: Scene Replication" excerpt: "Create multiplayer games in an instance (pun intended) with the new MultiplayerSpawner and MultiplayerSynchronizer nodes. Check out the key concepts, and get started with a quick tutorial on how to make a simple game using Godot multiplayer features!" c...
140976
## Spawning players For the player characters we usually need to transfer part of the authority over to the peer which each character represents. In this scenario it is good practice to use a child node dedicated to the player inputs, and leave the multiplayer authority of the character nodes to the server. This help...
140988
--- title: "Godot 3.2 will get pseudo 3D support in 2D engine" excerpt: "Godot support for 2D is already mature and most of our users enjoy working with it. There is, however a growing trend of adding 3D layers to 2D games, which can be seen in successful titles such as Hollow Knight or Rayman Origins." categories: ["p...
141036
--- title: "Introducing C# in Godot" excerpt: "The next alpha release of Godot 3.0 is about to be published and it will be the first version that ships with C# support. This post gives an introduction to C# scripting in Godot and how to use it in your project." categories: ["progress-report"] author: Ignacio Roldán Etc...
141167
# Downloads {% include articles/download_card.html version="4.3" release="rc1" article=page %} **Standard build** includes support for GDScript and GDExtension. **.NET build** (marked as `mono`) includes support for C#, as well as GDScript and GDExtension. - See also [C# platform support](https://docs.godotengine.or...
141174
--- title: "Optional typing in GDScript" excerpt: "Exposing the new addition to GDScript: optional type hints and all the perks it brings." categories: ["progress-report"] author: George Marques image: /storage/app/uploads/public/5b1/f4f/b2f/5b1f4fb2f023a968578982.png date: 2018-07-22 17:11:27 --- While GDScript is ma...
141175
## How it was implemented Since many people seem to be interested in the devblogs, I'll add a section here explaining how I did the changes to enable the optional typing in GDScript. ### Tokenizer The first part of parsing a language is to split the code in recognizable *tokens*. The symbols (`+`, `>=`, `|`), keywor...
141185
--- title: "Editor improvements for Godot 4.0" excerpt: "If you are following my progress, you might have noticed that I took a two month break from rendering to work on many long standing editor improvements and features." categories: ["progress-report"] author: Juan Linietsky image: /storage/app/uploads/public/606/23...
142774
Important concepts and terminology #### Prompts & Completions The completions endpoint is the core component of the API service. This API provides access to the model's text-in, text-out interface. Users simply need to provide an input prompt containing the English text command, and the model will generate a text comp...
142777
jsonpointer==2.3 jsonschema==4.17.3 openai==0.26.5
142832
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Embedding texts that are longer than the model's maximum context length\n", "OpenAI's embedding models cannot embed text that exceeds a maximum length. The maximum length varies by model, and is measured by _tokens_, not string ...
142833
"evalue": "Azure.RequestFailedException: This model's maximum context length is 8191 tokens, however you requested 10000 tokens (10000 in your prompt; 0 for the completion). Please reduce your prompt; or completion length.\r\nStatus: 400 (model_error)\r\n\r\nContent:\r\n{\n \"error\": {\n \"message\": \"This model'...
142834
"</style>" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "var tokenizer = await Tokenizer.CreateAsync(TokenizerModel.ada2);\n", "var truncated = tokenizer.TruncateByTokenCount(longText, 8191);\n", "longText.Length.Display();\n", "truncated.Length.Disp...
142894
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Azure chat completion models with your own data (preview)\n", "This example shows how to use Azure OpenAI service models with your own data. The feature is currently in preview. \n", "\n", "Azure OpenAI on your data enabl...
142904
{ "cells": [ { "cell_type": "markdown", "id": "278e7451", "metadata": {}, "source": [ "<h1 align =\"center\"> Python SDK Sample</h1>\n", "<hr>\n", "\n", "# Chat Completions\n", "\n", "Chat models take a series of messages as input, and return a model-generated message as output.\n...
142967
# Introduction This repository shows how to setup and use Azure OpenAI models' API with LangChain. ## Installation Install all Python modules and packages listed in the requirements.txt file using the below command. ```python pip install -r requirements.txt ``` ### Microsoft Azure Endpoints In order to use the Open ...
142969
"set_key(\".env\", \"OPENAI_API_VERSION\", \"Your api version here\")\n", "set_key(\".env\", \"COMPLETIONS_MODEL\", \"Your model here\")" ] }, { "cell_type": "markdown", "id": "4e595a7e-9b33-472d-96ff-e3229d723642", "metadata": {}, "source": [ "#### Get all required Environment Variables" ...
142970
"id": "b6a40126-bede-46dc-8922-8721ac2f9c22", "metadata": {}, "outputs": [], "source": [ "response = model.invoke(messages)" ] }, { "cell_type": "code", "execution_count": 32, "id": "876d40ef-a75f-4d62-bc0a-43de6b55ce30", "metadata": { "scrolled": true }, "outputs": [ { ...
142971
"id": "cb6794d6-ba1f-4367-bae6-af0136212713", "metadata": {}, "source": [ "Compared to hardcoding the roles like above, LangChain Messages allow for more flexibility and better management, especially with complex conversations involving multiple roles. It also simplifies the visualization of the conversation ...
142978
{ "cells": [ { "cell_type": "markdown", "id": "6d251ced", "metadata": {}, "source": [ "# How to use LangChain and Azure OpenAI with Python\n", "\n", "\n", "Langchain is an open source framework for developing applications using large language models (LLM). <br>\n", "\n", "This gui...
142979
"\n", "prompt = PromptTemplate(\n", "input_variables=[\"product_type\", \"customer_request\"],\n", "template=template,\n", ")\n", "\n", "print(\"Example #1:\")\n", "print(llm([HumanMessage(content=prompt.format(\n", " product_type=\"face wash\",\n", " customer_request =...
142980
jsonpointer==2.3 jsonschema==4.17.3 openai==1.11.1 tiktoken==0.3.1
142990
{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Azure OpenAI Service API with AAD authentication\n", "\n", "The reference for the AOAI REST API `/completions` method is [here](https://docs.microsoft.com/en-us/azure/cognitive-services/openai/reference/...
142999
# Packages needed to call AOAI API with the OpenAI Python API openai==1.12.0 # Packages needed to run the notebook samples jupyter # Other packages needed to run the notebook samples requests pytz pandas tenacity azure-search-documents==11.4.0b8
143009
{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Function calling with Azure Cognitive Search\n", "\n", "In this notebook, we'll show how to create a simple chatbot to help you find or create a good recipe. We'll create an index in Azure Cognitive Search using [vector searc...
143054
### Installation #### Project Initialization 1. Clone this repo into a new folder and navigate to the repo root folder in the terminal. 2. Run `azd auth login`. #### Use existing resources Due to high demand, Azure OpenAI resources can be difficult to spin up on the fly due to quota limitations. For this reason, we...
143055
### Skipping vectorization * Part of indexing the document chunks into Azure Cognitive Search will include vectorizing each chunk using an Azure OpenAI Embeddings model. The same is true for each search operation as well, as each search query will be vectorized using the same Embeddings model. If you would like to skip...
143132
approach_classifier: system_prompt: |- You are an intent classifier for Microsoft Surface product Sales and Marketing teams. The user will input a statement. You will focus on the main intent of the user statement and you respond with only one of four values - '1', '2', '3', '4', or '5'. ...
143174
# Overview This document will cover the following: 1. Current solution architecture 2. Other considerations ## Solution Architecture Below are the main components of the solution: 1. UI 2. Orchestrator 3. Data management 4. Simulation of RBAC 5. Prompt Template and Token Management 6. Instrumentation and Logging ...
143180
import argparse import html import io import openai import os import re import time import tiktoken from azure.ai.formrecognizer import DocumentAnalysisClient from azure.core.credentials import AzureKeyCredential from azure.identity import AzureDeveloperCliCredential from azure.search.documents import SearchClient from...
143284
{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "import openai\n", "from azure.identity import DefaultAzureCredential\n", "from azure.search.documents import SearchClient\n", "from azure.search.documents.models ...
143306
import json import os import tempfile import uuid import logging from azure.core.credentials import AzureKeyCredential from azure.core.exceptions import ResourceNotFoundError from azure.search.documents.indexes.aio import SearchIndexClient from azure.search.documents.aio import SearchClient from azure.search.document...
143349
ow - The following figure shows an overview of the solution ![](./docs/AOAI_VA_Overview.png "Overview of the VA workflow") ## Workflow components * Topic Classifier: This is responsible to determine the topic of the user input. The topic not only includes the business-related concepts but extends to include iden...
144141
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js"; /** * The parameters required to initialize an instance of the Embeddings * class. */ export type EmbeddingsParams = AsyncCallerParams; export interface EmbeddingsInterface { /** * An abstract method that takes an array of documents as ...
144145
/** * Type alias for a record where the keys are strings and the values can * be any type. This is used to represent the input values for a Chain. */ // eslint-disable-next-line @typescript-eslint/no-explicit-any export type InputValues = Record<string, any>; /** * Type alias for a record where the keys are string...
144169
import { test, expect } from "@jest/globals"; import { calculateMaxTokens, getModelContextSize } from "../base.js"; test("properly calculates correct max tokens", async () => { expect( await calculateMaxTokens({ prompt: "", modelName: "gpt-3.5-turbo-16k" }) ).toBe(16384); expect( await calculateMaxTokens...
144184
export function mapStoredMessagesToChatMessages( messages: StoredMessage[] ): BaseMessage[] { return messages.map(mapStoredMessageToChatMessage); } /** * Transforms an array of `BaseMessage` instances into an array of * `StoredMessage` instances. It does this by calling the `toDict` method * on each `BaseMessag...
144196
import { BaseMessage, BaseMessageChunk, mergeContent, _mergeDicts, type MessageType, } from "./base.js"; /** * Represents a system message in a conversation. */ export class SystemMessage extends BaseMessage { static lc_name() { return "SystemMessage"; } _getType(): MessageType { return "sys...
144197
import { it, describe, test, expect } from "@jest/globals"; import { filterMessages, mergeMessageRuns, trimMessages, } from "../transformers.js"; import { AIMessage } from "../ai.js"; import { ChatMessage } from "../chat.js"; import { HumanMessage } from "../human.js"; import { SystemMessage } from "../system.js"...
144198
describe("trimMessages can trim", () => { const messagesAndTokenCounterFactory = () => { const messages = [ new SystemMessage( "This is a 4 token text. The full message is 10 tokens." ), new HumanMessage({ content: "This is a 4 token text. The full message is 10 tokens.", ...
144199
it("can filter (endOn) with message classes", async () => { const { messages, dummyTokenCounter } = messagesAndTokenCounterFactory(); const trimmedMessages = await trimMessages(messages, { maxTokens: 40, tokenCounter: dummyTokenCounter, endOn: [HumanMessage], }); console.log(trimmedMes...
144400
// Default generic "any" values are for backwards compatibility. // Replace with "string" when we are comfortable with a breaking change. import { BaseStringPromptTemplate } from "./string.js"; import type { BasePromptTemplateInput, TypedPromptInputValues, } from "./base.js"; import { checkValidTemplate, parse...
144401
export class PromptTemplate< // eslint-disable-next-line @typescript-eslint/no-explicit-any RunInput extends InputValues = any, // eslint-disable-next-line @typescript-eslint/no-explicit-any PartialVariableName extends string = any > extends BaseStringPromptTemplate<RunInput, PartialVariableName> ...
144409
export class ChatPromptTemplate< // eslint-disable-next-line @typescript-eslint/no-explicit-any RunInput extends InputValues = any, // eslint-disable-next-line @typescript-eslint/no-explicit-any PartialVariableName extends string = any > extends BaseChatPromptTemplate<RunInput, PartialVariableName> ...
144411
import { BaseStringPromptTemplate } from "./string.js"; import type { BasePromptTemplateInput, TypedPromptInputValues, Example, } from "./base.js"; import type { BaseExampleSelector } from "../example_selectors/base.js"; import { type TemplateFormat, checkValidTemplate, renderTemplate, } from "./template.js...
144417
import { expect, test } from "@jest/globals"; import { PromptTemplate } from "../prompt.js"; import { Document } from "../../documents/document.js"; test("Test using partial", async () => { const prompt = new PromptTemplate({ template: "{foo}{bar}", inputVariables: ["foo"], partialVariables: { bar: "baz"...
144421
/* eslint-disable @typescript-eslint/no-explicit-any */ import { expect, test } from "@jest/globals"; import { AIMessagePromptTemplate, ChatPromptTemplate, ChatMessagePromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate, MessagesPlaceholder, } from "../chat.js"; import { PromptTemplate }...
144426
import { Document } from "../documents/document.js"; import { BaseDocumentTransformer } from "../documents/transformers.js"; /** * Interface that defines the methods for loading and splitting documents. */ export interface DocumentLoader { load(): Promise<Document[]>; loadAndSplit(textSplitter?: BaseDocumentTran...
144429
export interface DocumentInput< // eslint-disable-next-line @typescript-eslint/no-explicit-any Metadata extends Record<string, any> = Record<string, any> > { pageContent: string; metadata?: Metadata; /** * An optional identifier for the document. * * Ideally this should be unique across the documen...
144595
import { DocumentInterface } from "@langchain/core/documents"; import { Embeddings } from "@langchain/core/embeddings"; import { cosineSimilarity, euclideanDistance, innerProduct, } from "@langchain/core/utils/math"; import { VectorStore, VectorStoreRetriever, VectorStoreRetrieverInput, } from "@langchain/c...