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 fixes to cURL rendering and mime_type overriding #763

Merged
merged 12 commits into from
Jul 8, 2024

Conversation

anish-palakurthi
Copy link
Contributor

@anish-palakurthi anish-palakurthi commented Jul 8, 2024

Fixes:

  • mime_type is inferred from URL media input for non-URL-supporting providers, we now allow users to override this if they manually specify the media's mime_type
  • azure requests cURL rendering now include query parameters
  • raw cURL panel lets users toggle between streaming and non-streaming versions of their request
  • proxy media URL resolution calls for CORS media blocks
  • style changes for cURL panel
Screenshot 2024-07-08 at 3 34 22 PM

Copy link

vercel bot commented Jul 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
baml ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 8, 2024 10:46pm

@anish-palakurthi anish-palakurthi requested a review from hellovai July 8, 2024 19:24
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

  • engine/baml-runtime/src/internal/llm_client/primitive/openai/openai_client.rs: Added logging for base and proxy URLs; updated request URL to include query parameters.
  • engine/baml-runtime/src/internal/llm_client/traits/mod.rs: Enabled mime_type override; included query parameters in Azure cURL rendering; added toggle for streaming/non-streaming cURL requests.
  • typescript/playground-common/src/baml_wasm_web/EventListener.tsx: Introduced streamCurl atom for toggling cURL request types.
  • typescript/playground-common/src/shared/FunctionPanel.tsx: Added switch for streaming/non-streaming cURL requests; updated button styling.
  • engine/baml-schema-wasm/src/runtime_wasm/mod.rs: Changed logging level from 'Warn' to 'Info' in WebAssembly initialization.

7 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

  • engine/baml-runtime/src/internal/llm_client/primitive/openai/openai_client.rs: Removed logging for base and proxy URLs; added query parameters to Azure cURL rendering.
  • engine/baml-runtime/src/internal/llm_client/traits/mod.rs: Allowed mime_type override; included query parameters in Azure cURL; added toggle for streaming/non-streaming cURL requests.
  • engine/baml-schema-wasm/src/runtime_wasm/mod.rs: Updated logging level from Info to Warn during WebAssembly initialization.
  • typescript/playground-common/src/shared/Selectors.tsx: Minor class name and formatting adjustments.
  • typescript/playground-common/src/shared/SettingsDialog.tsx: Updated button class name for consistent styling.

5 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

  • Introduced should_proxy parameter to build_request in multiple clients for proxy URL management (/engine/baml-runtime/src/internal/llm_client/primitive/anthropic/anthropic_client.rs, /engine/baml-runtime/src/internal/llm_client/primitive/google/google_client.rs, /engine/baml-runtime/src/internal/llm_client/primitive/openai/openai_client.rs).
  • Updated render_raw_curl to include query parameters in Azure requests and toggle streaming/non-streaming (/engine/baml-runtime/src/internal/llm_client/traits/mod.rs).
  • Minor formatting adjustment in AWS client (/engine/baml-runtime/src/internal/llm_client/primitive/aws/aws_client.rs).
  • Deleted line affecting 'baml-render-url' header handling in VSCode extension (/typescript/vscode-ext/packages/vscode/src/extension.ts).

7 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

  • Fixed typo in destination_url variable name (/engine/baml-runtime/src/internal/llm_client/primitive/anthropic/anthropic_client.rs)
  • Ensured correct URL usage in request-building process (/engine/baml-runtime/src/internal/llm_client/primitive/anthropic/anthropic_client.rs)

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

  • Renamed should_proxy to allow_proxy for clarity (/engine/baml-runtime/src/internal/llm_client/primitive/anthropic/anthropic_client.rs, /engine/baml-runtime/src/internal/llm_client/primitive/google/google_client.rs, /engine/baml-runtime/src/internal/llm_client/primitive/openai/openai_client.rs, /engine/baml-runtime/src/internal/llm_client/primitive/request.rs)
  • Improved cURL rendering to include query parameters for Azure requests (/engine/baml-runtime/src/internal/llm_client/primitive/google/google_client.rs)
  • Allowed users to override inferred mime_type from URL media input (/engine/baml-runtime/src/internal/llm_client/primitive/google/google_client.rs)
  • Added toggle for streaming/non-streaming cURL requests in CurlSnippet component (/typescript/playground-common/src/shared/FunctionPanel.tsx)
  • Minor formatting fix in globals.css (/typescript/fiddle-frontend/app/globals.css)

6 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

  • Refactored media URL processing logic into process_media_urls function (/engine/baml-runtime/src/internal/llm_client/traits/mod.rs)
  • Added support for overriding mime_type (/engine/baml-runtime/src/internal/llm_client/traits/mod.rs)
  • Enhanced cURL rendering to include query parameters and toggle between streaming/non-streaming requests (/engine/baml-runtime/src/internal/llm_client/traits/mod.rs)
  • Switched client from AwsBedrock to Gemini and updated prompt (/integ-tests/baml_src/test-files/functions/input/named-args/single/named-image.baml)
  • Updated test cases to reflect client and prompt changes (/integ-tests/baml_src/test-files/functions/input/named-args/single/named-image.baml)

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

  • Improved cURL rendering and request body handling (/engine/baml-runtime/src/internal/llm_client/traits/mod.rs)
  • Ensured URL and headers are managed correctly (/engine/baml-runtime/src/internal/llm_client/traits/mod.rs)
  • Switched client from Gemini to AwsBedrock (/integ-tests/baml_src/test-files/functions/input/named-args/single/named-image.baml)
  • Updated prompt to describe an image in 4 words, including color (/integ-tests/baml_src/test-files/functions/input/named-args/single/named-image.baml)
  • Updated test cases with specific image URLs (/integ-tests/baml_src/test-files/functions/input/named-args/single/named-image.baml)

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings

@anish-palakurthi anish-palakurthi merged commit 67f9c6a into canary Jul 8, 2024
8 checks passed
@anish-palakurthi anish-palakurthi deleted the azure_curl_patch branch July 8, 2024 22:51
Copy link
Contributor

@hellovai hellovai left a comment

Choose a reason for hiding this comment

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

LGTM

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