Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Cannot Complete Notebook: Agent Chat with custom model loading #2381

Open
DLWCMD opened this issue Apr 13, 2024 · 7 comments
Open

[Bug]: Cannot Complete Notebook: Agent Chat with custom model loading #2381

DLWCMD opened this issue Apr 13, 2024 · 7 comments
Labels
0.2 Issues which are related to the pre 0.4 codebase needs-triage

Comments

@DLWCMD
Copy link

DLWCMD commented Apr 13, 2024

Describe the bug

This notebook requires use of filter dictionary to obtain information associated with building the custom model. Despite the efforts discussed below, I am not able to successfully apply a filter.

Following instructions, I created this expanded OAI_CONFIG_LIST

OAI_CONFIG_LIST = [
    {
        'model': 'gpt-3.5-turbo',
        'api_key': os.environ["OPENAI_API_KEY"],
    },
    {
        'model': 'gpt-4',
        'api_key': os.environ["OPENAI_API_KEY"],

    },
    {
        'model': 'gpt-4-turbo-preview',
        'api_key': os.environ["OPENAI_API_KEY"]
    },
    {
        'model_custom': 'Open-Orca/Mistral-7B-OpenOrca',
        'model_client_cls': 'CustomModelClient',
        'device': 'cuda',
        'n': 1,
        'params': {
          'max_length': 1000
          }
    }

]

Note the list includes the recommended additional dictionary to support the Open-Orca details"

{
    "model": "Open-Orca/Mistral-7B-OpenOrca",
    "model_client_cls": "CustomModelClient",
    "device": "cuda",
    "n": 1,
    "params": {
        "max_length": 1000,
    }
},

If I try the recommended approach to filter for model_client_cls, the filter fails and I receive the entire list:
[{'model_custom': 'Open-Orca/Mistral-7B-OpenOrca', 'model_client_cls': 'CustomModelClient', 'device': 'cuda', 'n': 1, 'params': {'max_length': 1000}}]

I then decided to try a filter of a element in the original OAI_CONFIG_LIST, as follows:
filter_dict = {"model": "gpt-3.5-turbo"}
config_list = autogen.filter_config(config_list, filter_dict)

This fails with the following message:

[/usr/local/lib/python3.10/dist-packages/autogen/oai/openai_utils.py](https://localhost:8080/#) in _satisfies(config_value, acceptable_values)
    442             return bool(set(config_value) & set(acceptable_values))  # Non-empty intersection
    443         else:
--> 444             return config_value in acceptable_values
    445 
    446     if filter_dict:

TypeError: 'in <string>' requires string as left operand, not NoneType

Steps to reproduce

Using the notebook, try to apply the filter on the Open_Orca dictionary or the original OAI_CONFIG_LIST as shown above.

Model Used

gpt-3.5-turbo
gpt_4
gpt-4-turbo-preview
Open-Orca/Mistral-7B-OpenOrca

Expected Behavior

Applying the filter dictionary should have returned a filtered list in both examples.

Screenshots and logs

No response

Additional Information

pyautogen-0.2.23-py3-none-any.whl
macOS Sonoma 14.4.1 on macBookAir with M2 chip
Python 3.10

@DLWCMD DLWCMD added the bug label Apr 13, 2024
@sonichi
Copy link
Contributor

sonichi commented Apr 14, 2024

@olgavrou could you take a look?

@mdazfar2
Copy link

mdazfar2 commented Apr 14, 2024

@DLWCMD could you upload the pic or any screenshot! that is why it can be more elaborated clearly that what you can says

@DLWCMD
Copy link
Author

DLWCMD commented Apr 14, 2024 via email

@sonichi
Copy link
Contributor

sonichi commented Apr 19, 2024

Could you use filter_dict = {"model": ["gpt-3.5-turbo"]} ?
cc @ekzhu in case this issue implies any work needed in documentation

@DLWCMD
Copy link
Author

DLWCMD commented Apr 19, 2024 via email

@DLWCMD
Copy link
Author

DLWCMD commented Apr 19, 2024 via email

@khanhdu1609
Copy link

@DLWCMD Can you explain the max_length in params for me? I don't know what it means?

@rysweet rysweet added 0.2 Issues which are related to the pre 0.4 codebase needs-triage labels Oct 2, 2024
@fniedtner fniedtner removed the bug label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.2 Issues which are related to the pre 0.4 codebase needs-triage
Projects
None yet
Development

No branches or pull requests

6 participants