Skip to content

feat: add support for Hugging Face Inference API #279

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

Merged
merged 1 commit into from
Apr 18, 2025
Merged

Conversation

chr-hertel
Copy link
Member

@chr-hertel chr-hertel commented Apr 13, 2025

  • 1st Commit: Christopher
  • 2nd Commit: Claude Desktop with Jetbrains MCP:

    I'm writing a PHP library that is similar to langchain but should also cover the HuggingFace inference API - like their library.
    You can access my terminal and my IDE via tools.
    Please have a look at the different tasks that should be available in src/Bridge/HuggingFace/Task.php and see the example implementation in examples/huggingface/text-classification.php in combination with the namespace PhpLlm\LlmChain\Bridge\HuggingFace.
    Your task is to implement the response conversion, corresponding DTOs and examples for all other tasks than text-classification.

  • 3rd Commit: Claude Desktop with Jetbrains MCP:

    please have a look at the other examples in the examples/ folder using audio, image or text input and refactor the ones you just created.
    all new example files are located in /home/christopher/Projects/PHP-LLM/llm-chain/examples/huggingface - please verify they're working by executing them - and patch bugs if there are any

  • 4th Commit: Claude Desktop with Jetbrains MCP:

    please create an example runner for huggingface examples, based on the /example file in root directory

  • 5th Commit: Christopher making it work.

Base automatically changed from refactor-model-version-to-name to main April 14, 2025 20:17
@chr-hertel chr-hertel changed the title feat: add support for hugging face inference api feat: add support for Hugging Face Inference API Apr 14, 2025
@chr-hertel chr-hertel force-pushed the feat-hugging-face branch 4 times, most recently from 6aff43b to 16b12af Compare April 18, 2025 19:25
@chr-hertel chr-hertel changed the base branch from main to refactor-file-handling April 18, 2025 21:53
@chr-hertel chr-hertel force-pushed the feat-hugging-face branch 2 times, most recently from 035fff0 to 1e1c9ad Compare April 18, 2025 22:23
@chr-hertel chr-hertel marked this pull request as ready for review April 18, 2025 22:24
chr-hertel added a commit that referenced this pull request Apr 18, 2025
Preparation for #279 

* Introducing a base File that centralizes mime type, base64 handling,
etc.
* Image split into ImageUrl and Image based on File => i usually know
what i need in user land
  * `new Image('https://...')` => `new ImageUrl('https://...)`
* `new Image('data:image/jpeg;base64,...')` =>
`Image::fromDataUrl('data:image/jpeg;base64,...')`
* `new Image('/path/to/jpeg.jpg')` =>
`Image::fromFile('/path/to/jpeg.jpg')`
* removing `File` class of Whisper bridge in favor of `Audio`
Base automatically changed from refactor-file-handling to main April 18, 2025 22:30
@chr-hertel chr-hertel merged commit e38cb0d into main Apr 18, 2025
7 checks passed
@chr-hertel chr-hertel deleted the feat-hugging-face branch April 18, 2025 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant