-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4841ace
commit 172255b
Showing
6 changed files
with
49 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export type { Tools as ToolsType } from "./client/Client"; | ||
export { ToolsExtended as Tools } from "./client/wrapper/Client"; | ||
export * from "./client"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export * as Letta from "./api"; | ||
export { LettaClient } from "./Client"; | ||
export { LettaClient } from "./wrapper/Client"; | ||
export { LettaEnvironment } from "./environments"; | ||
export { LettaError, LettaTimeoutError } from "./errors"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { LettaClient as FernClient } from "../Client"; | ||
import { Tools } from "./ToolsClient"; | ||
|
||
export class LettaClient extends FernClient { | ||
|
||
protected _tools: Tools | undefined; | ||
|
||
public get tools(): Tools { | ||
return (this._tools ??= new Tools(this._options)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import dedent from 'dedent'; | ||
|
||
import { Letta } from ".."; | ||
import { Tools as FernTools } from "../api/resources/tools/client/Client"; | ||
|
||
export class Tools extends FernTools { | ||
/** | ||
* Create a new tool from a function | ||
* | ||
* @param {ToolCreateFromFunction} request | ||
* @param {Tools.RequestOptions} requestOptions - Request-specific configuration. | ||
* | ||
* @throws {@link Letta.UnprocessableEntityError} | ||
* | ||
* @example | ||
* await client.tools.create({ | ||
* func: tool_implementation | ||
* }) | ||
*/ | ||
public async createFromFunction( | ||
request: ToolCreateFromFunction, | ||
requestOptions?: FernTools.RequestOptions | ||
): Promise<Letta.LettaSchemasToolTool> { | ||
const toolCreateRequest: Letta.ToolCreate = { | ||
...request, | ||
sourceCode: dedent(request.func.toString()), | ||
}; | ||
return this.create(toolCreateRequest, requestOptions); | ||
} | ||
} | ||
|
||
export interface ToolCreateFromFunction extends Omit<Letta.ToolCreate, "sourceCode"> { | ||
func: Function; | ||
} |