Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@fluid-experimental/ai-collab
Advanced tools
Experimental package to simplify integrating AI into Fluid-based applications
The ai-collab client library makes adding complex, human-like collaboration with LLM's built directly in your application as simple as one function call. Simply pass your SharedTree and ask AI to collaborate. For example,
This file is where we define the types of our task management application's SharedTree data
// --------- File name: "types.ts" ---------
import { SchemaFactory, type treeView } from "@fluidframework/tree";
const sf = new SchemaFactory("ai-collab-sample-application");
export class Task extends sf.object("Task", {
title: sf.required(sf.string, {
metadata: { description: `The title of the task` },
}),
id: sf.identifier,
description: sf.required(sf.string, {
metadata: { description: `The description of the task` },
}),
priority: sf.required(sf.string, {
metadata: { description: `The priority of the task in three levels, "low", "medium", "high"` },
}),
complexity: sf.required(sf.number, {
metadata: { description: `The complexity of the task as a fibonacci number` },
}),
status: sf.required(sf.string, {
metadata: { description: `The status of the task as either "todo", "in-progress", or "done"` },
}),
assignee: sf.required(sf.string, {
metadata: { description: `The name of the tasks assignee e.g. "Bob" or "Alice"` },
}),
}) {}
export class TaskList extends sf.array("TaskList", SharedTreeTask) {}
export class Engineer extends sf.object("Engineer", {
name: sf.required(sf.string, {
metadata: { description: `The name of an engineer whom can be assigned to a task` },
}),
id: sf.identifier,
skills: sf.required(sf.string, {
metadata: { description: `A description of the engineers skills which influence what types of tasks they should be assigned to.` },
}),
maxCapacity: sf.required(sf.number, {
metadata: { description: `The maximum capacity of tasks this engineer can handle measured in in task complexity points.` },
}),
}) {}
export class EngineerList extends sf.array("EngineerList", SharedTreeEngineer) {}
export class TaskGroup extends sf.object("TaskGroup", {
description: sf.required(sf.string, {
metadata: { description: `The description of the task group, which is a collection of tasks and engineers that can be assigned to said tasks.` },
}),
id: sf.identifier,
title: sf.required(sf.string, {
metadata: { description: `The title of the task group.` },
}),
tasks: sf.required(SharedTreeTaskList, {
metadata: { description: `The lists of tasks within this task group.` },
}),
engineers: sf.required(SharedTreeEngineerList, {
metadata: { description: `The lists of engineers within this task group which can be assigned to tasks.` },
}),
}) {}
export class TaskGroupList extends sf.array("TaskGroupList", SharedTreeTaskGroup) {}
export class PlannerAppState extends sf.object("PlannerAppState", {
taskGroups: sf.required(SharedTreeTaskGroupList, {
metadata: { description: `The list of task groups that are being managed by this task management application.` },
}),
}) {}
import { aiCollab } from "@fluid-experimental/ai-collab";
import { PlannerAppState } from "./types.ts"
// This is not a real file, this is meant to represent how you initialize your app data.
import { initializeAppState } from "./yourAppInitializationFile.ts"
// --------- File name: "app.ts" ---------
// Initialize your app state somehow
const appState: PlannerAppState = initializeAppState({
taskGroups: [
{
title: "My First Task Group",
description: "Placeholder for first task group",
tasks: [
{
assignee: "Alice",
title: "Task #1",
description:
"This is the first Sample task.",
priority: "low",
complexity: 1,
status: "todo",
},
],
engineers: [
{
name: "Alice",
maxCapacity: 15,
skills:
"Senior engineer capable of handling complex tasks. Versed in most languages",
},
{
name: "Charlie",
maxCapacity: 7,
skills: "Junior engineer capable of handling simple tasks. Versed in Node.JS",
},
],
},
],
})
// Typically, the user would input this through a UI form/input of some sort.
const userAsk = "Update the task group description to be a about creating a new Todo list application. Create a set of tasks to accomplish this and assign them to the available engineers. Keep in mind the max capacity of each engineer as you assign tasks."
// Collaborate with AI one function call.
const response = await aiCollab({
openAI: {
client: new OpenAI({
apiKey: OPENAI_API_KEY,
}),
modelName: "gpt-4o",
},
treeNode: view.root.taskGroups[0],
prompt: {
systemRoleContext:
"You are a manager that is helping out with a project management tool. You have been asked to edit a group of tasks.",
userAsk: userAsk,
},
planningStep: true,
finalReviewStep: true,
dumpDebugLog: true,
});
if (response.status === 'sucess') {
// Render the UI view of your task groups.
window.alert(`The AI has successfully completed your request.`);
} else {
window.alert(`Something went wrong! response status: ${response.status}, error message: ${response.errorMessage}`);
}
Once the aiCollab
function call is initiated, an LLM will immediately begin attempting to make changes to your Shared Tree using the provided user prompt, the types of your SharedTree and the provided app guidance. The LLM produces multiple changes, in a loop asynchronously. Meaning, you will immediatley see changes if your UI's render loop is connected to your SharedTree App State.
/explicit-strategy
: The new explicit strategy, utilizing the prototype built during the fall FHL, with a few adjustments.
agentEditReducer
: This file houses the logic for taking in a TreeEdit
, which the LLM produces, and applying said edit to theagentEditTypes.ts
: The types of edits an LLM is prompted to produce in order to modify a SharedTree.idGenerator.ts
: `A manager for producing and mapping simple id's in place of UUID hashes when generating prompts for an LLMjsonTypes.ts
: utility JSON related types used in parsing LLM response and generating LLM prompts.promptGeneration.ts
: Logic for producing the different types of prompts sent to an LLM in order to edit a SharedTree.typeGeneration.ts
: Generates serialized(/able) representations of a SharedTree Schema which is used within prompts and the generated of the structured output JSON schemautils.ts
: Utilities for interacting with a SharedTree/implicit-strategy
: The original implicit strategy, currently not used under the exported aiCollab API surface.These are the platform requirements for the current version of Fluid Framework Client Packages. These requirements err on the side of being too strict since within a major version they can be relaxed over time, but not made stricter. For Long Term Support (LTS) versions this can require supporting these platforms for several years.
It is likely that other configurations will work, but they are not supported: if they stop working, we do not consider that a bug. If you would benefit from support for something not listed here, file an issue and the product team will evaluate your request. When making such a request please include if the configuration already works (and thus the request is just that it becomes officially supported), or if changes are required to get it working.
strict
options are supported.strictNullChecks
is required.exactOptionalPropertyTypes
is currently not fully supported.
If used, narrowing members of Fluid Framework types types using in
, Reflect.has
, Object.hasOwn
or Object.prototype.hasOwnProperty
should be avoided as they may incorrectly exclude undefined
from the possible values in some cases.Node16
, NodeNext
, or Bundler
resolution should be used with TypeScript compilerOptions to follow the Node.js v12+ ESM Resolution and Loading algorithm.
Node10 resolution is not supported as it does not support Fluid Framework's API structuring pattern that is used to distinguish stable APIs from those that are in development.
ES Modules: ES Modules are the preferred way to consume our client packages (including in NodeJs) and consuming our client packages from ES Modules is fully supported.
CommonJs: Consuming our client packages as CommonJs is supported only in NodeJS and only for the cases listed below. This is done to accommodate some workflows without good ES Module support. If you have a workflow you would like included in this list, file an issue. Once this list of workflows motivating CommonJS support is empty, we may drop support for CommonJS one year after notice of the change is posted here.
There are many ways to contribute to Fluid.
Detailed instructions for working in the repo can be found in the Wiki.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services. Use of these trademarks or logos must follow Microsoft’s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Not finding what you're looking for in this README? Check out fluidframework.com.
Still not finding what you're looking for? Please file an issue.
Thank you!
This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
Use of these trademarks or logos must follow Microsoft's Trademark & Brand Guidelines.
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
FAQs
Experimental package to simplify integrating AI into Fluid-based applications
The npm package @fluid-experimental/ai-collab receives a total of 10 weekly downloads. As such, @fluid-experimental/ai-collab popularity was classified as not popular.
We found that @fluid-experimental/ai-collab demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.