{"id":16385345,"url":"https://github.com/paparascal2020/eloquent-ai","last_synced_at":"2025-10-26T11:30:59.955Z","repository":{"id":228209813,"uuid":"773410290","full_name":"PapaRascal2020/eloquent-ai","owner":"PapaRascal2020","description":"An eloquent style syntax for Open AI and other AI's.","archived":true,"fork":false,"pushed_at":"2024-08-31T14:22:41.000Z","size":78,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T23:17:47.446Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PapaRascal2020.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-17T15:35:34.000Z","updated_at":"2024-09-13T20:40:09.000Z","dependencies_parsed_at":"2024-05-16T05:34:57.407Z","dependency_job_id":null,"html_url":"https://github.com/PapaRascal2020/eloquent-ai","commit_stats":null,"previous_names":["paparascal2020/eloquent-ai"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PapaRascal2020%2Feloquent-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PapaRascal2020%2Feloquent-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PapaRascal2020%2Feloquent-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PapaRascal2020%2Feloquent-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PapaRascal2020","download_url":"https://codeload.github.com/PapaRascal2020/eloquent-ai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238319376,"owners_count":19452329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T04:14:18.003Z","updated_at":"2025-10-26T11:30:54.651Z","avatar_url":"https://github.com/PapaRascal2020.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!CAUTION]\n\u003e The package has moved and this repo has been archived: please visit https://github.com/PapaRascal2020/sidekick to keep using this package.\n\n\u003e [!CAUTION]\n\u003e This package is in very early development and should not be on a production server.\n\n\u003e [!NOTE]  \n\u003e If you are interested in this idea and can help contribute please don't hesitate to \n\u003e do so and create a pull request =)\n\n## Eloquent AI for Laravel\nAn eloquent approach to AI in Laravel.\n\n![Latest Version](https://img.shields.io/badge/Version-0.0.3-blue)\n![Stability](https://img.shields.io/badge/Stability-alpha-red)\n\n### About\nInspired by Eloquent ORM, Eloquent AI provides a wrapper for interacting with AI.\n\n**AI Models Supported:**\n\n- Open Ai\n  - gpt-3.5-turbo\n  - gpt-4\n  - tts-1\n  - tts-1-hd\n  - dall-e-2\n  - dall-e-3\n  - whisper-1\n  - text-embedding-3-small\n  - text-embedding-3-large\n  - text-embedding-ada-002\n  - text-moderation-latest\n  - text-moderation-stable\n  - text-moderation-007\n- Mistral AI\n  - mistral-small-latest\n  - mistral-medium-latest\n  - mistral-large-latest\n  - open-mistral-7b\n  - mistral-embed\n- Claude AI\n   - claude-3-opus-20240229\n   - claude-3-sonnet-20240229\n   - claude-3-haiku-20240307\n\nThe aim of this project is to create a package where switching between\nAIs and there models as simple as possible.\n\nThis will be achieved by created a common syntax for calling different services\n(Completions, Text To Speech, Speech To Text, Text To Image) in a way that is similar to eloquent.\n\nExamples of the syntax are at the bottom of this readme.\n\n### Installation\n\nIn your Laravel app do the following:\n\nIn `composer.json` add the following repository to the `repositories` section:\n\n```php\n\"repositories\": [\n    {\n        \"type\": \"vcs\",\n        \"url\": \"https://github.com/PapaRascal2020/eloquent-ai\"\n    }\n],\n```\nThen add the following to the `require` section.\n\n```array\n    \"antley/eloquent-ai\": \"dev-main\"\n```\n\nSave `composer.json`\n\nThen, open `config/app.php` and add the following to `ServiceProvider`:\n\n```php\n\\Antley\\EloquentAi\\EloquentAiServiceProvider::class,\n```\n\nOnce this is done, open the terminal and type the following:\n\n```bash\n composer update\n```\n\nThat's it! You are now ready to use the package.\n\n### Getting Started\n\nThere are six services and they are:\n\n- **Completions** - _To chat with AI_\n- **Embedding** - _To create vector representations of your text_\n- **Image** - _To generate images by user input._\n- **Audio** - _Take text and convert to audio_\n- **Transcription** - _Take an audio file and return text_\n- **Moderation** - _Moderate a string of text (i.e Comment) for harmful content_\n\nCurrently, Open AI offers all of them where as Claude AI \u0026 Mistral AI are for some.\nTo get the best out of this plugin you will need at least an Open AI api key, you \ncan get this by going to https://platform.openai.com and registering an account.\n\nFor Mistral AI (https://console.mistral.ai/) \u0026 Claude AI (https://console.anthropic.com/)\nmodels you would need to get sign up on the relevant sites (above)\n\nStart by updating your `.env` file with the following fields.\n\n```dotenv\nELOQUENT_AI_CLAUDEAI_TOKEN=YOUR_CLAUDEAI_API_TOKEN (Optional - if you want to use its models)\nELOQUENT_AI_OPENAI_TOKEN=YOUR_OPENAI_API_TOKEN (Required)\nELOQUENT_AI_MISTRALAI_TOKEN=YOUR_MISTRALAI_API_TOKEN (optional - if you want to use its models)\n```\nYou are now ready to use the examples below to create your AI calls.\n\n#### Examples:\n\n##### Completion\n\n```php\nreturn  EloquentAi::completion()-\u003ecreate([\n    ['role' =\u003e 'user', 'content' =\u003e 'Hello'],\n    ['role' =\u003e 'assistant', 'content' =\u003e 'Why hello there! How can I help?'],\n    ['role' =\u003e 'user', 'content' =\u003e 'Are you the bot from Minstral AI or Open AI?'],\n])-\u003ewithInstruction(\"You are a friendly AI assistant\")\n-\u003euse(\"open-ai.gpt-4\") // \u003c-- Not required, defaults to 'open-ai.gpt-3.5-turbo'..\n-\u003efetch();\n```\n\n##### Embedding\n\n```php\nreturn EloquentAi::embedding()-\u003ecreate([\n        'This is a sample embedding'\n    ])-\u003euse('mistral-ai.mistral-embed')-\u003efetch();\n```\n\n##### Image (Image From Text)\n\n```php\nreturn EloquentAi::image()-\u003ecreate([\n    'prompt' =\u003e 'A guy on a jet ski looking towards brighton',\n    'size' =\u003e '512x512',\n    'n' =\u003e 1 \n])-\u003efetch();\n```\n##### Audio (Text To Speech)\n\n```php\nreturn EloquentAi::audio()-\u003ecreate([\n    'input' =\u003e 'Hello, this is my audio generation',\n    'voice' =\u003e 'alloy'\n])-\u003efetch();\n```\n\n##### Transcription (Speech To Text)\n\n```php\nreturn EloquentAi::transcription()-\u003ecreate([\n    'file' =\u003e public_path('/harvard.wav')\n])-\u003efetch();\n```\n###### Example Response\n```json\n{\n  \"text\":\"The stale smell of old beer lingers. It takes heat to bring out the odor. A cold dip restores health and zest. A salt pickle tastes fine with ham. Tacos al pastor are my favorite. A zestful food is the hot cross bun.\"\n}\n```\n\n##### Moderation \nThis is a service where you feed it text from a comment for example and it will return \nwith an array of boolean values for certain moderation points.\n\n```php\nreturn EloquentAi::moderate()\n-\u003ecreate('This is an example thread with no bad content')\n-\u003efetch();\n```\n###### Example Response\n\n```json\n{\n  \"id\":\"modr-94DxgkEGhw7yJDlq8oCrLOVXnqli5\",\n  \"model\":\"text-moderation-007\",\n  \"results\":[\n    {\n      \"flagged\":true,\n      \"categories\":{\n        \"sexual\":false,\n        \"hate\":false,\n        \"harassment\":true,\n        \"self-harm\":false,\n        \"sexual\\/minors\":false,\n        \"hate\\/threatening\":false,\n        \"violence\\/graphic\":false,\n        \"self-harm\\/intent\":false,\n        \"self-harm\\/instructions\":false,\n        \"harassment\\/threatening\":false,\n        \"violence\":false\n      },\n      \"category_scores\":{\n        \"sexual\":0.02169245481491089,\n        \"hate\":0.024598680436611176,\n        \"harassment\":0.9903337359428406,\n        \"self-harm\":5.543852603295818e-5,\n        \"sexual\\/minors\":2.5174302209052257e-5,\n        \"hate\\/threatening\":2.9870452635805123e-6,\n        \"violence\\/graphic\":6.8601830207626335e-6,\n        \"self-harm\\/intent\":0.0002317160106031224,\n        \"self-harm\\/instructions\":0.00011696072033373639,\n        \"harassment\\/threatening\":1.837775380408857e-5,\n        \"violence\":0.00020553809008561075\n      }\n    }\n  ]}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaparascal2020%2Feloquent-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaparascal2020%2Feloquent-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaparascal2020%2Feloquent-ai/lists"}