Skip to content

Commit 9245522

Browse files
committed
content update
1 parent d26dcf6 commit 9245522

File tree

3 files changed

+19
-45
lines changed

3 files changed

+19
-45
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changelog
22

3-
- v1.0.0 deployment
3+
- v1.0.2 initial release
44

55
All notable changes to `sharpapi-laravel-client` will be documented in this file.

README.md

+16-40
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
[![Latest Version on Packagist](https://img.shields.io/packagist/v/sharpapi/sharpapi-laravel-client.svg?style=flat-square)](https://packagist.org/packages/sharpapi/sharpapi-laravel-client)
1111
[![Total Downloads](https://img.shields.io/packagist/dt/sharpapi/sharpapi-laravel-client.svg?style=flat-square)](https://packagist.org/packages/sharpapi/sharpapi-laravel-client)
1212

13-
Assisting coders with the most repetitive content analysis and content generation processing needs of any app or
13+
Assisting coders with the most repetitive content analysis
14+
and content generation processing needs of any app or
1415
platform.
15-
SharpAPI is an easy-to-use REST API endpoints to help automate your app AI content processing whether it's:
16+
SharpAPI is an easy-to-use REST API endpoints to help automate your
17+
app AI content processing whether it's:
1618
[E-commerce](https://sharpapi.com/#ecommerce),
1719
[HR Tech](https://sharpapi.com/#hr),
1820
[Travel](https://sharpapi.com/#tth),
@@ -25,6 +27,9 @@ or [SEO](https://sharpapi.com/#seo).
2527
- PHP >= 8.1
2628
- Laravel >= 9.0
2729

30+
If you don't use Laravel then you can find
31+
[Generic SharpAPI PHP Client here »](https://github.com/sharpapi/sharpapi-php-client)
32+
2833
## Features
2934

3035
Please refer to the official:
@@ -46,7 +51,7 @@ Please refer to the official:
4651

4752
## Installation
4853

49-
1. You can install the package via composer:
54+
1. You can install the package via `composer`:
5055

5156
```bash
5257
composer require sharpapi/sharpapi-laravel-client
@@ -66,10 +71,6 @@ SHARP_API_KEY=8bKzQl3cwckfVsnsN8T8p4BsACkziEQJ72U4pXpQ
6671

6772
You can inject `SharpApiService` class or use the facade `\SharpApiService` singleton.
6873

69-
Underlying HTTP requests are powered via [Laravel HTTP Client/Guzzle](https://laravel.com/docs/10.x/http-client),
70-
so it's a good idea to check for
71-
typical [Guzzle Exceptions](https://docs.guzzlephp.org/en/stable/quickstart.html#exceptions).
72-
7374
We recommend you to use Laravel queuing system to optimize dispatched jobs
7475
and the process of checking the results, especially if you process bigger batches of data.
7576

@@ -143,37 +144,11 @@ class SharpTest extends Controller
143144
}
144145
```
145146

147+
#### Guzzle Exceptions
146148
The underlying HTTP requests are facilitated by
147149
[Laravel HTTP Client/Guzzle](https://laravel.com/docs/10.x/http-client),
148150
making it advisable to familiarize yourself with common
149151
[Guzzle Exceptions](https://docs.guzzlephp.org/en/stable/quickstart.html#exceptions).
150-
151-
For optimal performance, we suggest leveraging Laravel's queuing system
152-
when dispatching jobs, particularly when handling larger datasets.
153-
This enhances the efficiency of both job dispatching and result retrieval processes.
154-
155-
The typical use case involves the following steps:
156-
157-
1. Dispatch one of the available AI processing methods, which will provide a job processing status URL.
158-
2. Execute the `pollJobStatusAndFetchResults($statusUrl)` method, operating in polling mode and making requests every 10
159-
seconds for a duration of 180 seconds (modifiable,
160-
see [optional custom configuration](#optional-custom-configuration)).
161-
3. Receive a `SharpApiJob` object.
162-
4. For a job marked as `success`, retrieve the results using one of the available methods, such
163-
as `$jobResultJson = $jobResult->getResultJson()`.
164-
165-
**Generally, each dispatched job concludes within a timeframe ranging from a few seconds to a minute.**
166-
167-
Upon completion, a job with a `success` status will have its results ready for further processing. Different API
168-
methods/endpoints yield varying return formats; refer to
169-
the [List of API methods/endpoints](#list-of-api-methodsendpoints) for details.
170-
171-
Our API ensures consistent formatting in every response. However, it's worth noting that AI engines utilized by SharpAPI
172-
may occasionally exhibit aberrant behavior, leading to timeouts or inaccurate data. In such instances, the job status
173-
will be marked as `failed`. Simply rerun the identical job request in these cases.
174-
175-
While the job is actively processed by our engine, it will consistently report a `pending` status.
176-
177152
```php
178153
use GuzzleHttp\Exception\ClientException;
179154

@@ -240,15 +215,16 @@ methods will return different data structure.
240215
Please refer to the detailed examples provided
241216
at [SharpAPI.com](https://sharpapi.com/)
242217

218+
For methods that have `language` parameter you can also use
219+
`SharpApiLanguages` Enum values to make your code more readable.
220+
243221
### HR
244222

245223
#### Parse Resume/CV File
246224

247225
Parses a resume (CV) file from multiple formats (PDF/DOC/DOCX/TXT/RTF) and returns an extensive object of data points.
248226

249-
The file has to be uploaded as `form-data` parameter called `file`.
250-
251-
An optional language parameter can also be provided (`English` value is set as the default one) .
227+
An optional output language parameter can also be provided (`English` value is set as the default one) .
252228

253229
```php
254230
$statusUrl = \SharpApiService::parseResume('/test/resume.pdf', 'English');
@@ -308,7 +284,7 @@ Parses the customer's product review and provides its sentiment (POSITIVE/NEGATI
308284
with a score between 0-100%. Great for sentiment report processing for any online store.
309285

310286
```php
311-
$statusUrl = \SharpApiService::productReviewSentiment('review contents', 'English');
287+
$statusUrl = \SharpApiService::productReviewSentiment('review contents');
312288
```
313289

314290
#### Product Categories
@@ -414,7 +390,7 @@ Parses the Travel/Hospitality product review and provides its sentiment
414390
Great for sentiment report processing for any online store.
415391

416392
```php
417-
$statusUrl = \SharpApiService::travelReviewSentiment($text, 'English');
393+
$statusUrl = \SharpApiService::travelReviewSentiment($text);
418394
```
419395

420396
#### Tours & Activities Product Categories
@@ -455,7 +431,7 @@ $statusUrl = \SharpApiService::hospitalityProductCategories(
455431

456432
### Do you think our API is missing some obvious functionality?
457433

458-
[Please let us know»](https://github.com/sharpapi/laravel-client/issues)
434+
[Please let us know»](https://github.com/sharpapi/sharpapi-laravel-client/issues)
459435

460436
## Changelog
461437

src/SharpApiService.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -236,12 +236,11 @@ public function relatedJobPositions(string $jobPositionName, string $language =
236236
*
237237
* @api
238238
*/
239-
public function productReviewSentiment(string $review, string $language = 'English'): string
239+
public function productReviewSentiment(string $review): string
240240
{
241241
$url = $this->apiBaseUrl.'/ecommerce/review_sentiment';
242242
$response = $this->makeRequest('POST', $url, [
243243
'content' => $review,
244-
'language' => $language,
245244
]);
246245

247246
return $this->parseStatusUrl($response);
@@ -429,12 +428,11 @@ public function generateSeoTags(string $text, string $language = 'English'): str
429428
*
430429
* @api
431430
*/
432-
public function travelReviewSentiment(string $text, string $language = 'English'): string
431+
public function travelReviewSentiment(string $text): string
433432
{
434433
$url = $this->apiBaseUrl.'/tth/review_sentiment';
435434
$response = $this->makeRequest('POST', $url, [
436435
'content' => $text,
437-
'language' => $language,
438436
]);
439437

440438
return $this->parseStatusUrl($response);

0 commit comments

Comments
 (0)