This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Output exceeds the size limit. Open the full output data in a text editor | |
| --------------------------------------------------------------------------- | |
| ImportError Traceback (most recent call last) | |
| Cell In[16], line 1 | |
| ----> 1 from llama_index import ( | |
| 2 GPTPineconeIndex, | |
| 3 GPTSimpleKeywordTableIndex, | |
| 4 SimpleDirectoryReader, | |
| 5 LLMPredictor, | |
| 6 ServiceContext |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type Vector = { | |
| id: string | |
| values: number[] | |
| } | |
| const assertSameLength = (vectors: Vector[]): void => { | |
| if (new Set(vectors.map(vector => vector.values.length)).size !== 1) { | |
| throw new Error('All vectors must have the same length'); | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const uniqueObjectArray = [...new Map(objectArray.map((item) => [item["id"], item])).values()]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const sensitiveDataResponse = await fetch(sensitiveInformationURL, { | |
| headers: { | |
| Authorization: `Bearer ${accessToken}SOME_ROGUE_CHARACTERS`, | |
| }, | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function App() { | |
| const auth = useAuth(); | |
| const isAuthenticated = auth.userData?.id_token ? true : false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { AuthProvider } from "oidc-react"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Aserto authorizer middleware function | |
| const checkAuthz = jwtAuthz(authzOptions); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { jwtAuthz } = require("express-jwt-aserto"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Protected API endpoint | |
| app.get("/api/protected", checkJwt, checkAuthz, function (req, res) { | |
| //send the response | |
| res.json({ secret: "Very sensitive information presented here" }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const authzOptions = { | |
| authorizerServiceUrl: process.env.AUTHORIZER_SERVICE_URL, | |
| policyId: process.env.POLICY_ID, | |
| policyRoot: process.env.POLICY_ROOT, | |
| authorizerApiKey: process.env.AUTHORIZER_API_KEY, | |
| tenantId: process.env.TENANT_ID, | |
| }; |
NewerOlder