You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the project above, there is one part about we need to inject the tool function into the prompt, and with python language, it as achieved by inspect.signature. For now, I still does not find the same way for this goal in javascript.
Any good ideas or thoughts can implement the same job?
For example, I'm using the prompt like below, I injected the function defination and params defination without automation approach. It's stupid but works. I'm trying to find a better approach to inject the tool() function into prompt.
You will be given a task to perform. You should output either
- A Javascript code that provides the solution to the whole task.
- Any output you want to extract you should create the variables and set the variables values.
- Code should be output in a fenced code block.
- Text to be shown directly to the user, if you want to ask for more information or provide the final answer.
In addition to the Javascript standard library, you can use the following functions:
/**
* Performs a search using the Tavily API with the provided keywords.
*
* @param query - The search query string.a
* @returns A promise that resolves to an array of search results, where each result is an object with the following properties:
* - \`title\`: The title of the search result (string).
* - \`url\`: The URL of the search result (string).
* - \`content\`: The processed content of the search result (string).
* - \`rawContent\`: The unprocessed content of the search result, if available (string, optional).
* - \`score\`: The relevance score of the search result (number).
* - \`publishedDate\`: The publication date of the search result (string).
*/
export const tavilySearch = async (query: string): Promise<TavilySearchResult[]>
/**
* Generates a report based on the provided options.
*
* @param options - The options for generating the report.
* @param options.type - The type of report to generate, either 'website' or 'pdf'.
* @param options.description - A description of the report.
* @returns A promise that resolves to an object containing the URL of the generated report.
*/
async function generateReport(options: IReportOptions): Promise<IReportResult>
Reminder:
- You should design a solution using multiple functions to achieve the final goal. After executing the code, you should get the final result for this task.
- Use Javascript code snippets to call tools
- All JavaScript functions are asynchronous, and you should use \`await\` to execute and retrieve the results of each function.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Actually, I'm trying to implement the CodeAct in langchain or langgraph.js. And I saw this project https://github.com/langchain-ai/langgraph-codeact/blob/main/langgraph_codeact/__init__.py
In the project above, there is one part about we need to inject the tool function into the prompt, and with python language, it as achieved by
inspect.signature
. For now, I still does not find the same way for this goal in javascript.Any good ideas or thoughts can implement the same job?
For example, I'm using the prompt like below, I injected the function defination and params defination without automation approach. It's stupid but works. I'm trying to find a better approach to inject the
tool()
function into prompt.Beta Was this translation helpful? Give feedback.
All reactions