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

Add AzureOpenAiStructureConfig, default azure_deployment #788

Merged
merged 7 commits into from
May 20, 2024

Conversation

vachillo
Copy link
Member

@vachillo vachillo commented May 17, 2024

closes #790

  • Add AzureOpenAiStructureConfig
  • Update Azure drivers to default the value of azure_deployment to the model
  • small updates to docs examples
  • Add AzureOpenAiVisionImageQueryDriver
  • set serializable=False for azure_ad_token

@vachillo vachillo force-pushed the azure_structure_config branch 2 times, most recently from 0998f4b to 9e2a7b5 Compare May 17, 2024 17:47
@vachillo vachillo changed the base branch from dev to refactor/default-configs May 17, 2024 18:22
@vachillo vachillo changed the base branch from refactor/default-configs to dev May 20, 2024 15:34
@vachillo vachillo closed this May 20, 2024
@vachillo vachillo reopened this May 20, 2024
@vachillo vachillo changed the title Add AzureOpenAiStructureConfig Add AzureOpenAiStructureConfig, default azure_deployment May 20, 2024
@vachillo vachillo marked this pull request as ready for review May 20, 2024 19:06
Comment on lines 4 to 11
# pull_request_review:
# types: [submitted]
pull_request:
branches:
- dev
jobs:
test:
if: github.event.review.state == 'APPROVED'
# if: github.event.review.state == 'APPROVED'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice hack to get tests running haha. Just need to revert.

Copy link
Member

@collindutter collindutter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also pls update changelog.

kw_only=True, default=None, metadata={"serializable": False}
)
api_key: str = field(kw_only=True, default=None, metadata={"serializable": False})
prompt_driver: AzureOpenAiChatPromptDriver = field(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the Driver type hints should use the base class so that they can be overridden with non-azure drivers.

azure_ad_token_provider: Optional[Callable[[], str]] = field(
kw_only=True, default=None, metadata={"serializable": False}
)
api_key: str = field(kw_only=True, default=None, metadata={"serializable": False})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Optional type hint.

azure_ad_token_provider: Optional[Callable[[], str]] = field(
kw_only=True, default=None, metadata={"serializable": False}
)
api_key: str = field(kw_only=True, default=None, metadata={"serializable": False})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have this field anywhere else, wondering if we should add to the base class?

Copy link
Member Author

@vachillo vachillo May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably makes sense actually, i dont really see the benefit. the base class wouldn't do anything with the api_key field by default; at best it reduces some code, at worst it obfuscates where that field is getting pulled from. also some config classes don't use api_key at all (aws bedrock drivers/config)

prompt_driver: AzureOpenAiChatPromptDriver = field(
default=Factory(
lambda self: AzureOpenAiChatPromptDriver(
model="gpt-4o",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this out of preview yet? If not we should probably use gpt-4-turbo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would have to be just gpt-4, gpt-4-turbo is a "version" of gpt-4 as far as azure openai is concerned.

vector_store_driver: A Local Vector Store Driver.
"""

azure_endpoint: str = field(kw_only=True, metadata={"serializable": True})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing azure_deployment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the deployments now default to the model. it doesn't make sense on the top-level of the config because the deployments are per model.

Comment on lines +132 to +141
config=deserialized_config.merge_config({
"prompt_driver" : {
"model": "anthropic.claude-3-sonnet-20240229-v1:0",
},
}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be a good place to show off how azure_deployment can be merged in.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated on the azure openai example

Copy link
Member

@collindutter collindutter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Let's merge after #794 to make sure we're not missing anything.

collindutter
collindutter previously approved these changes May 20, 2024
Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@vachillo vachillo merged commit 540e8f3 into dev May 20, 2024
12 checks passed
@vachillo vachillo deleted the azure_structure_config branch May 20, 2024 23:13
hkhajgiwale pushed a commit to hkhajgiwale/griptape that referenced this pull request May 25, 2024
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.

Add AzureOpenAiStructureConfig
2 participants