Skip to content

Conversation

@insop
Copy link
Contributor

@insop insop commented Mar 2, 2024

BootstrapFewShot failing due to lm.copy for AzureOpenAI, likely due to positional argument issue from recent changes.

Environment

Error message

  • during BootstrapFewShot run, code errored out due to missing arguments, api_version
>[dspy/dsp/modules/lm.py](https://file+.vscode-resource.vscode-cdn.net/Users/insop/Projects/Github/NLP/dspy/dsp/modules/lm.py)(106)copy()
    102         model = kwargs.pop('model')
    105
--> 106         return self.__class__(model, **kwargs)

Changes

AzureOpenAI expects positional arguments, so it is failing. I am putting my change for review if that will impact other models.

class AzureOpenAI(LM):
...

    def __init__(
        self,
        api_base: str,
        api_version: str,
        model: str = "gpt-3.5-turbo-instruct",
        api_key: Optional[str] = None,
        model_type: Literal["chat", "text"] = "chat",
        **kwargs,
    ):

BootstrapFewShot failing due to lm.copy for AzureOpenAI, likely due to positional argument issue from recent changes.

- code: 98304a2
- model azure openai

- during `BootstrapFewShot` run, code errored out due to missing arguments, `api_version`

```
>[dspy/dsp/modules/lm.py](https://file+.vscode-resource.vscode-cdn.net/Users/insop/Projects/Github/NLP/dspy/dsp/modules/lm.py)(106)copy()
    102         model = kwargs.pop('model')
    105
--> 106         return self.__class__(model, **kwargs)
```

AzureOpenAI expects positional arguments, so it is failing.
I will add my fixes and see if that will impact other models.

```
class AzureOpenAI(LM):
...

    def __init__(
        self,
        api_base: str,
        api_version: str,
        model: str = "gpt-3.5-turbo-instruct",
        api_key: Optional[str] = None,
        model_type: Literal["chat", "text"] = "chat",
        **kwargs,
    ):
@insop
Copy link
Contributor Author

insop commented Mar 2, 2024

@KCaverly , @okhat

@okhat
Copy link
Collaborator

okhat commented Mar 2, 2024

Maybe set those values globally?

@insop
Copy link
Contributor Author

insop commented Mar 2, 2024

Maybe set those values globally?

Thank you @okhat

Are you suggesting to set those as a global during the running?
I am not too sure.

How would that be better?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants