Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"cliVersion": "4.13.0",
"cliVersion": "4.78.0",
"generatorName": "fernapi/fern-python-sdk",
"generatorVersion": "4.59.4",
"generatorVersion": "5.0.0",
"generatorConfig": {
"client_class_name": "Captain"
},
"sdkVersion": "0.1.1"
"originGitCommit": "773c74e2dd953382ea51bbcc2300f803128e5de5",
"sdkVersion": "0.1.2"
}
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: ci
on: [push]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
compile:
runs-on: ubuntu-latest
Expand All @@ -9,7 +14,7 @@ jobs:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
Expand All @@ -25,7 +30,7 @@ jobs:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
Expand All @@ -45,7 +50,7 @@ jobs:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: "3.10"
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | python - -y --version 1.5.1
Expand Down
62 changes: 30 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,19 @@ Instantiate and use the client with the following:
from runcaptain import Captain

client = Captain(
organization_id="YOUR_ORGANIZATION_ID",
key="YOUR_KEY",
key="<token>",
organization_id="<X-Organization-ID>",
)
response = client.query.collection_v2stream(
collection_name="collection_name",
query="query",

client.query.collection_v2(
collection_name="my_documents",
query="What are the key terms in the contract?",
inference=True,
stream=True,
rerank=True,
top_k=10,
include_bbox=False,
)
for chunk in response.data:
yield chunk
```

## Async Client
Expand All @@ -59,18 +63,21 @@ import asyncio
from runcaptain import AsyncCaptain

client = AsyncCaptain(
organization_id="YOUR_ORGANIZATION_ID",
key="YOUR_KEY",
key="<token>",
organization_id="<X-Organization-ID>",
)


async def main() -> None:
response = await client.query.collection_v2stream(
collection_name="collection_name",
query="query",
await client.query.collection_v2(
collection_name="my_documents",
query="What are the key terms in the contract?",
inference=True,
stream=True,
rerank=True,
top_k=10,
include_bbox=False,
)
async for chunk in response.data:
yield chunk


asyncio.run(main())
Expand All @@ -85,7 +92,7 @@ will be thrown.
from runcaptain.core.api_error import ApiError

try:
client.query.collection_v2stream(...)
client.query.collection_v2(...)
except ApiError as e:
print(e.status_code)
print(e.body)
Expand Down Expand Up @@ -120,15 +127,11 @@ The `.with_raw_response` property returns a "raw" client that can be used to acc
```python
from runcaptain import Captain

client = Captain(
...,
)
with client.query.with_raw_response.collection_v2stream(...) as response:
print(
response.headers
) # access the response headersprint(response.status_code) # access the response status code
for chunk in response.data:
print(chunk) # access the underlying object(s)
client = Captain(...)
response = client.query.with_raw_response.collection_v2(...)
print(response.headers) # access the response headers
print(response.status_code) # access the response status code
print(response.data) # access the underlying object
```

### Retries
Expand All @@ -146,7 +149,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
Use the `max_retries` request option to configure this behavior.

```python
client.query.collection_v2stream(..., request_options={
client.query.collection_v2(..., request_options={
"max_retries": 1
})
```
Expand All @@ -156,17 +159,12 @@ client.query.collection_v2stream(..., request_options={
The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.

```python

from runcaptain import Captain

client = Captain(
...,
timeout=20.0,
)

client = Captain(..., timeout=20.0)

# Override timeout for a specific method
client.query.collection_v2stream(..., request_options={
client.query.collection_v2(..., request_options={
"timeout_in_seconds": 1
})
```
Expand Down
Loading
Loading