Senior Data Engineer
📍 Rio de Janeiro, Brazil
📧 jduarte.dev@gmail.com
📱 +55 21 96810-2733
🔗 LinkedIn: https://www.linkedin.com/in/jvsduarte
💻 GitHub: https://github.com/joaovictordesouzaduarte
Senior Data Engineer
📍 Rio de Janeiro, Brazil
📧 jduarte.dev@gmail.com
📱 +55 21 96810-2733
🔗 LinkedIn: https://www.linkedin.com/in/jvsduarte
💻 GitHub: https://github.com/joaovictordesouzaduarte
| # if can be used as an expression | |
| # Equivalent of C's '?:' ternary operator | |
| "yay!" if 0 > 1 else "nay!" # => "nay!" | |
| # You can look at ranges with slice syntax. | |
| # The start index is included, the end index is not | |
| # (It's a closed/open range for you mathy types.) | |
| li[1:3] # Return list from index 1 to 2 => [2, 4] | |
| li[2:] # Return list starting from index 2 => [4, 3] | |
| li[:3] # Return list from beginning until index 3 => [1, 2, 4] |
I was explaining to a non-technical stakeholder, in the context of Artificial Inteligence, how the process of divide a large text into smaller texts (chunks) works. We used a library called LangChain to make this process, so the explanation was about the internals of how LangChain create the chunks from the input text.
This investigation started because we wanted to understand (and, if possible, to control) how this library was breaking down the text to make the chunks.
PS: this conversation happened in a slack-channel on october 26th, 2023, and the content here is simply a copy-and-paste of the conversation.
PS²: Pinecone, mentioned in the end of the conversation, is a vector-database. We use it to store the text-chunks, so we could query it by giving some piece of text, and it would return similar chunks that it has stored.
---- the conversation starts here ----
| // MockedError Provider | |
| import React from 'react'; | |
| import { ApolloProvider } from '@apollo/react-hooks'; | |
| import { InMemoryCache } from 'apollo-cache-inmemory'; | |
| import { ApolloLink, Observable } from 'apollo-link'; | |
| import { ApolloClient } from 'apollo-client'; | |
| import { GraphQLError } from 'graphql'; | |
| type Props = { |
| import React, { useState } from "react"; | |
| import LoginComponent from "./LoginComponent"; | |
| const usersTest = Array(8) | |
| .fill({ name: "", cns: "" }) | |
| .map((_, index) => ({ | |
| name: `User ${index}`, | |
| cns: `123.456.${index}`, | |
| })); |
| import React from "react"; | |
| import { TouchableOpacity, Text, StyleSheet, View } from "react-native"; | |
| import TVEventHandler from "TVEventHandler"; | |
| import Video from "react-native-video"; | |
| const ITEMS = [ | |
| { | |
| color: "#f0f", | |
| text: "Rosa" | |
| }, |
| import { PermissionsAndroid } from 'react-native'; | |
| export const PERMISSIONS_TYPES = { | |
| WRITE_EXTERNAL_STORAGE: 'WRITE_EXTERNAL_STORAGE', | |
| READ_EXTERNAL_STORAGE: 'READ_EXTERNAL_STORAGE', | |
| }; | |
| const PERMISSIONS = { | |
| [PERMISSIONS_TYPES.WRITE_EXTERNAL_STORAGE]: { | |
| type: 'WRITE_EXTERNAL_STORAGE', |
| const parseDegreeToRadians = (degrees) => degrees * (Math.PI / 180); | |
| const calculateDistanceBetweenTwoCoordinates = (firstCoordinate, secondCoordinate) => { | |
| const EARTH_RADIUS = 6371; | |
| const deltaLatitude = parseDegreeToRadians(secondCoordinate.latitude - firstCoordinate.latitude); | |
| const deltaLongitude = parseDegreeToRadians(secondCoordinate.longitude - firstCoordinate.longitude); | |
| const haversinesInnerTerm = Math.sin(deltaLatitude / 2) * Math.sin(deltaLatitude / 2) + | |
| Math.cos(parseDegreeToRadians(firstCoordinate.latitude)) * Math.cos(parseDegreeToRadians(secondCoordinate.longitude)) * |
| // @flow | |
| import { Dimensions, Platform } from 'react-native'; | |
| const screenWidth = Dimensions.get('window').width; | |
| const screenHeight = Dimensions.get('window').height; | |
| const IPHONEX_WIDTH = 375; | |
| const IPHONEX_HEIGHT = 812; |
| // @flow | |
| import { Platform } from 'react-native'; | |
| import RNFetchBlob from 'rn-fetch-blob'; | |
| import shorthash from 'shorthash'; | |
| const BASE_DIRECTORY_PATH = `${RNFetchBlob.fs.dirs.DocumentDir}/bon_appetit`; | |
| const FILE_PREFIX = Platform.OS === 'ios' ? '' : 'file://'; | |
| const verifyResourceAlreadyExists = async (path: string): any => { |