Add configuration options for method description when registering tools

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

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.

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...")
Dominant language
Python
Stars
179
Forks
32
Avg merge
1d 3h
Merged PRs (30d)
10

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

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.

More from posit-dev/chatlas

All issues in posit-dev/chatlas

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.