posit-dev / posit-dev/chatlas

Add configuration options for method description when registering tools

Open
#35 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
176
Forks
28
Avg merge
18h 42m
Merged PRs (30d)
16

Description

When registering tools, I would like the ability to set a maximum length for the function description or override the description parsed from __doc__

openai.BadRequestError: Error code: 400 - {'error': {'message': "Invalid 'tools[0].function.description': string too long. Expected a string with maximum length 1024, but got a string with length 1463 instead.", 'type': 'invalid_request_error', 'param': 'tools[0].function.description', 'code': 'string_above_max_length'}}

For example,

def my_func():
    """
    A really long docstring...
    """
    pass

chat.register_tool(my_func, max_doc_length=1024)

# or

chat.register_tool(my_func, doc="A shorter docstring...")

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The entry point mentioned is chat.register_tool; start by locating its implementation and the code that derives descriptions from doc. Done means supporting a maximum description length and an explicit replacement description, including the 1024-character case shown in the report.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.