Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/miurla/morphic into anthropic
Browse files Browse the repository at this point in the history
  • Loading branch information
miurla committed Jun 21, 2024
2 parents cee8c8f + 6f1c46e commit b9d3e64
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
5 changes: 3 additions & 2 deletions lib/agents/tools/retrieve.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { tool } from 'ai'
import { retrieveSchema } from '@/lib/schema/retrieve'
import { ToolProps } from '.'
import { SearchSkeleton } from '@/components/search-skeleton'
import { SearchResults as SearchResultsType } from '@/lib/types'
import RetrieveSection from '@/components/retrieve-section'

export const retrieveTool = ({ uiStream, fullResponse }: ToolProps) => ({
export const retrieveTool = ({ uiStream, fullResponse }: ToolProps) => tool({
description: 'Retrieve content from the web',
parameters: retrieveSchema,
execute: async ({ url }: { url: string }) => {
execute: async ({ url }) => {
let hasError = false
// Append the search section
uiStream.append(<SearchSkeleton />)
Expand Down
9 changes: 2 additions & 7 deletions lib/agents/tools/search.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { tool } from 'ai'
import { createStreamableValue } from 'ai/rsc'
import Exa from 'exa-js'
import { searchSchema } from '@/lib/schema/search'
import { SearchSection } from '@/components/search-section'
import { ToolProps } from '.'

export const searchTool = ({ uiStream, fullResponse }: ToolProps) => ({
export const searchTool = ({ uiStream, fullResponse }: ToolProps) => tool({
description: 'Search the web for information',
parameters: searchSchema,
execute: async ({
Expand All @@ -13,12 +14,6 @@ export const searchTool = ({ uiStream, fullResponse }: ToolProps) => ({
search_depth,
include_domains,
exclude_domains
}: {
query: string
max_results: number
search_depth: 'basic' | 'advanced'
include_domains: string[]
exclude_domains: string[]
}) => {
let hasError = false
// Append the search section
Expand Down
5 changes: 3 additions & 2 deletions lib/agents/tools/video-search.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { tool } from 'ai'
import { createStreamableValue } from 'ai/rsc'
import { searchSchema } from '@/lib/schema/search'
import { ToolProps } from '.'
import { VideoSearchSection } from '@/components/video-search-section'

// Start Generation Here
export const videoSearchTool = ({ uiStream, fullResponse }: ToolProps) => ({
export const videoSearchTool = ({ uiStream, fullResponse }: ToolProps) => tool({
description: 'Search for videos from YouTube',
parameters: searchSchema,
execute: async ({ query }: { query: string }) => {
execute: async ({ query }) => {
let hasError = false
// Append the search section
const streamResults = createStreamableValue<string>()
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"remark-math": "^6.0.0",
"sonner": "^1.4.41",
"tailwind-merge": "^2.2.2",
"tailwindcss-animate": "^1.0.7"
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8"
},
"devDependencies": {
"typescript": "^5",
Expand Down

0 comments on commit b9d3e64

Please sign in to comment.