Skip to content

Commit 8402191

Browse files
authored
Merge pull request #2 from Saif-Shines/refactor/content
Refactor - Content
2 parents 2eae95d + d33380d commit 8402191

8 files changed

Lines changed: 23 additions & 24 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Portkey wants to make it easy to work with Large Models that expose an API by of
1212

1313
Imagine portkey as a hop away from the LLMs enabling you with a lot of functionality out of the box.
1414

15-
![Portkey diagram](https://github.com/roh26it/portkey-quick-start/blob/main/images/portkey-middleware.png?raw=true)
15+
![Portkey diagram](/images/portkey-middleware-v2.jpeg)
1616

1717
#PromptOps #LLMOps #LMOps
1818

@@ -40,4 +40,4 @@ We’re adding more features fast, but key areas of focus for Portkey will be hi
4040

4141
The best part about Portkey is that you can get started with minimal effort. Just replace your OpenAI (or any other provider’s) endpoint to the portkey proxy and we’ll get you setup within minutes!
4242

43-
Read the [Quickstart Guide](https://github.com/roh26it/portkey-quick-start/blob/main/quickstart.md) next
43+
Get Started with the [Quickstart Guide](https://github.com/roh26it/portkey-quick-start/blob/main/quickstart.md)

caching.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This could be useful if you have fixed input prompts or are testing the app with
88

99
To enable caching, pass the following headers in your requests.
1010

11-
```
11+
```sh
1212
"x-portkey-cache": true
1313
"Cache-Control": "max-age:1000"
1414
```
@@ -19,6 +19,6 @@ The `x-portkey-cache` enables or disables cache storage and retrieval. The `Cach
1919

2020
You can choose to force refresh cache by using the `x-portkey-cache-force-refresh` header. Setting it to `true` ensures that the cache is invalidated, and a new value is stored in the cache.
2121

22-
```
22+
```sh
2323
"x-portkey-cache-force-refresh": true
2424
```

feedback.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ curl --location 'https://api.portkey.ai/v1/feedback/' \
1919
}'
2020
```
2121
**URL**: `https://api.portkey.ai/v1/feedback/`
22-
<br>
2322
**Method**: `POST`
24-
2523
**Request Body**<br>
2624
The request body should contain a `Feedback object` or an array of `Feedback objects`
27-
<br>
25+
2826

2927
| Key | Description | Options |
3028
|---|---|---|
@@ -37,13 +35,13 @@ The request body should contain a `Feedback object` or an array of `Feedback obj
3735

3836
### Examples
3937

40-
#### 1. Implementing a 👍🏻 / 👎🏻 feedback
38+
#### Implementing a 👍🏻 / 👎🏻 feedback
4139

4240
In many UI implementations, you would request a user to rate a generation with a simple thumbs up or thumbs down. You can use the `/feedback` endpoint to capture this user intent along with the generation's trace-id so you can aggregate the data at your end.
4341

4442
You can make an API call as the user clicks a thumbs up button like this
4543

46-
```
44+
```sh
4745
curl --location 'https://api.portkey.ai/v1/feedback/' \
4846
--header 'x-portkey-api-key: <YOUR PORTKEY API KEY>' \
4947
--header 'Content-Type: application/json' \
@@ -52,6 +50,6 @@ curl --location 'https://api.portkey.ai/v1/feedback/' \
5250
"value": 1
5351
}'
5452
```
55-
Thumbs up can have a `value` of 1 and thumbs down can have a value of of -1. We're not adding any weights since both the values should be weighted equally.
53+
- Thumbs up can have a `value` of 1 and thumbs down can have a value of of -1. We're not adding any weights since both the values should be weighted equally.
5654

57-
If the user also decides to leave a comment with their selection, you can add the `text` parameter to capture the user's comment.
55+
- If the user also decides to leave a comment with their selection, you can add the `text` parameter to capture the user's comment.

images/portkey-middleware-v2.jpeg

230 KB
Loading

metadata.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ print(llm(text))
6666

6767
## Model completion metadata
6868

69-
Coming soon
69+
_Coming soon_

quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This guide allows you to integrate with Portkey in a minute.
88
You can create an account on Portkey with your work email address and get the authentication key needed later in the integration.
99

1010
You can get your API key from the profile dropdown
11-
![Portkey copy API key](https://github.com/Portkey-AI/quick-start/blob/main/images/copy-api-key.png)
11+
![Portkey copy API key](/images/copy-api-key.png)
1212

1313
## 2. Insert the Portkey endpoint
1414
Replace the OpenAI (or any other provider’s) endpoint to the portkey proxy endpoint and add the portkey authentication headers.
@@ -73,5 +73,5 @@ print(llm(text))
7373
## 3. View real-time activity in your account
7474
As the API requests start flowing in, you’ll see the activity in your account instantly.
7575

76-
## Metadata in Requests
76+
#### Metadata in Requests
7777
If you'd like to send additional metadata with your requests, you can add it as part of the headers. [Read more here](https://github.com/Portkey-AI/quick-start/blob/main/metadata.md).

retry.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Automatic Retries with Portkey
22

3-
Portkey has an in-built retry mechanism that makes sure your requests get fulfilled. We implement a retry mechanism with exponential backoff. This can be managed by the `x-portkey-retry-count` header.
3+
Portkey has an in-built retry mechanism that makes sure your requests get fulfilled. We implement a retry mechanism with exponential backoff. This can be managed by the `x-portkey-retry-count` header.
44

5-
```
6-
HEADER:
5+
```sh
6+
# HEADER:
77
x-portkey-retry-count: "number of times you want the API to be retried (max 5)"
88
```
99

@@ -25,7 +25,7 @@ response = openai.ChatCompletion.create(
2525
```
2626

2727
For Javascript
28-
```javascript
28+
```js
2929
const configuration = new Configuration({
3030
organization: "YOUR_ORG_ID",
3131
apiKey: process.env.OPENAI_API_KEY,
@@ -66,4 +66,5 @@ agent = initialize_agent(tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION
6666
agent.run("What is 56 multiplied by 17654 to the 0.43 power?")
6767
```
6868

69-
Note: The max value of retries available is 5.
69+
> NOTE: The max value of retries available is 5
70+

tracing-requests.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
Portkey supports tracing that allows you to monitor your generative AI apps end-to-end. To enable tracing, you can pass a `trace-id` in the header of any Portkey request (proxy or otherwise) and it will be tracked through the journey of the request.
44

5-
```
6-
HEADER:
5+
```sh
6+
# HEADER:
77
x-portkey-trace-id: "enter_your_trace_id_here"
88
```
99

@@ -43,9 +43,9 @@ const configuration = new Configuration({
4343
### Using Tracing with Langchain Agents
4444
A common use case of tracing is to capture the flow of a langchain agent request. When using Portkey with langchain, you can pass your Trace ID in the headers and all the embeddings & completion requests will get tagged with the same Trace ID.
4545

46-
Sample Langchain Agent Code with Tracing Enabled
46+
##### Sample Langchain Agent Code with Tracing Enabled
4747
```python
48-
rom langchain.agents import load_tools
48+
from langchain.agents import load_tools
4949
from langchain.agents import initialize_agent
5050
from langchain.agents import AgentType
5151
from langchain.llms import OpenAI
@@ -68,7 +68,7 @@ agent.run("What is 56 multiplied by 17654 to the 0.43 power?")
6868

6969
When we run this, we get view following logs on Portkey
7070

71-
![Trace Logs in Portkey](https://github.com/Portkey-AI/quick-start/blob/main/images/trace-logs.gif)
71+
![Trace Logs in Portkey](/images/trace-logs.gif)
7272

7373
### Managing user feedback via Trace IDs
7474
Trace IDs can also be used to link user feedback to generations. You can implement a thumbs up / thumbs down user feedback system or something more complex with our feedback APIs. This feedback can be linked to traces which can span over 1 generation or multiple ones.

0 commit comments

Comments
 (0)