hkulekci / qdrant-php

Qdrant is a vector similarity engine & vector database. It deploys as an API service providing search for the nearest high-dimensional vectors. With Qdrant, embeddings or neural network encoders can be turned into full-fledged applications for matching, searching, recommending, and much more!
MIT License
93 stars 21 forks source link

Add `executeRaw` to main client class #32

Closed gregpriday closed 10 months ago

gregpriday commented 1 year ago

As suggested here: https://github.com/hkulekci/qdrant-php/issues/31

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.03% :tada:

Comparison is base (f33b689) 87.60% compared to head (45a2fd6) 87.64%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #32 +/- ## ============================================ + Coverage 87.60% 87.64% +0.03% - Complexity 278 279 +1 ============================================ Files 57 57 Lines 936 939 +3 ============================================ + Hits 820 823 +3 Misses 116 116 ``` | [Flag](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/32/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/32/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0) | `87.64% <100.00%> (+0.03%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files Changed](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/32?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0) | Coverage Δ | | |---|---|---| | [src/Endpoints/AbstractEndpoint.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/32?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL0VuZHBvaW50cy9BYnN0cmFjdEVuZHBvaW50LnBocA==) | `86.95% <100.00%> (ø)` | | | [src/Qdrant.php](https://app.codecov.io/gh/hkulekci/qdrant-php/pull/32?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Haydar+K%C3%9CLEKC%C4%B0#diff-c3JjL1FkcmFudC5waHA=) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

hkulekci commented 1 year ago

Hello @gregpriday, could we initialize a Helper class or a request factory instead of using a static method inside AbstractEndpoint? Without changing the AbstractEndpoint or the client itself, we can use execute() method of the Client itself, which is public. What do you think?

hkulekci commented 1 year ago

Actually, HttpFactory serves this purpose even. Here an example:

$config = new \Qdrant\Config(QDRANT_HOST);
$config->setApiKey(QDRANT_API_KEY);

$client = new Qdrant(new GuzzleClient($config));

# Getting cluster info with custom request
$httpFactory = new \GuzzleHttp\Psr7\HttpFactory();
$request = $httpFactory->createRequest('GET', 'cluster');
$response = $client->execute($request);
var_dump($response);

# Using method for cluster info
var_dump($client->cluster()->info());
hkulekci commented 10 months ago

Hey @gregpriday I will close this PR. Please update and create a new one if you want to continue working on this topic again and let's discuss it. Thanks for the suggestions here.