Example Flow:
| import os | |
| from langchain.agents import Tool | |
| from langchain.tools.retriever import create_retriever_tool | |
| from langchain_openai import OpenAIEmbeddings | |
| from indexclient import IndexChroma | |
| from crewai import Agent, Task, Crew, Process | |
| # TODO | |
| # I had to install langchain_chroma seperately. It should be included in the requirements |
| //Thank you ChatGPT | |
| function jsonSchemaToGraphQLFragment(schema, typeName, setPrefix = false) { | |
| // Helper function to resolve $ref references within the schema | |
| function resolveRef(ref, defs) { | |
| const refPath = ref.replace(/^#\/\$defs\//, ''); | |
| return defs[refPath]; | |
| } | |
| // Helper function to process each field in the schema |
| type EmbeddingContext { | |
| # context is the transformed representation of a node before obtaining embeddings. | |
| # This can include the node's content with added context information for embedding tasks like summaries, etc. | |
| # Raw document is used if it's null. | |
| context: String @string(maxLength:100000000) | |
| # contextDescription is a human-readable description of the context. | |
| contextDescription: String! @string(maxLength:600) | |
| # category is the category or namespace for the embedding. |
| type Book { | |
| name: String! @string(maxLength: 255) | |
| editor: Person @relation | |
| description: String! @string(maxLength: 1000) | |
| inLanguage: String! @string(maxLength: 50) | |
| keywords: [String!]! @list(maxLength: 20) | |
| isbn: [String!]! @list(maxLength: 5) | |
| publisher: Publisher @relation | |
| datePublished: Date | |
| locationCreated: Place @relation |
| apiVersion: v1 | |
| kind: ConfigMap | |
| metadata: | |
| name: ipfs-env | |
| labels: | |
| app: ipfs | |
| data: | |
| IPFS_ENABLE_S3: "true" | |
| IPFS_S3_REGION: "us-east-1" | |
| IPFS_S3_BUCKET_NAME: "**" |
| /** | |
| * | |
| * NAME: main | |
| * | |
| */ | |
| "use strict"; | |
| (() => { | |
| var __defProp = Object.defineProperty; | |
| var __getOwnPropNames = Object.getOwnPropertyNames; |
| /** | |
| * NAME: main | |
| */ | |
| import * as dagCBOR from '@ipld/dag-cbor'; | |
| import { sha256 } from 'multiformats/hashes/sha2'; | |
| import * as Block from 'multiformats/block'; | |
| const go = async () => { |
| type Index @createModel(accountRelation: LIST, description: "A Simple Index"){ | |
| controller_did: DID! @documentAccount | |
| title: String! @string(maxLength:1000) | |
| version: CommitID! @documentVersion | |
| collab_action: String @string(maxLength:150) | |
| created_at: DateTime! | |
| updated_at: DateTime! | |
| deleted_at: DateTime | |
| } |
| did:3:kjzl6cwe1jw149zw96t9xgvyurdk24zvx5eyyhaw61vmd08hk3tkx9dvlt21ans |