diff --git a/README.md b/README.md index 179e4c0a9..9c44f7f6d 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,13 @@ Exciting news! We're participating in DevFest.AI throughout October 2024! ๐Ÿ—“ - [Adding Tools to Agents](#adding-tools-to-agents) - [Managing Sessions and Users](#managing-sessions-and-users) - [Document Integration and Search](#document-integration-and-search) +- [Integrations](#integrations) + - [Brave Search](#brave-search) + - [BrowserBase](#browserbase) + - [Email](#email) + - [Spider](#spider) + - [Weather](#weather) + - [Wikipedia](#wikipedia) - [SDK Reference](#sdk-reference) - [API Reference](#api-reference) @@ -104,14 +111,19 @@ Exciting news! We're participating in DevFest.AI throughout October 2024! ๐Ÿ—“ ## Introduction - +Julep is a platform for creating AI agents that remember past interactions and can perform complex tasks. It offers long-term memory and manages multi-step processes. -Julep is a platform for creating AI agents that maintain state and execute complex workflows. It offers long-term context and orchestrates multi-step tasks. +Julep enables the creation of multi-step tasks incorporating decision-making, loops, parallel processing, and integration with numerous external tools and APIs. -Julep lets you define multi-step tasks that can include conditional logic, loops, parallel processing, and built-in integration with 100s of external tools and APIs. Typically AI applications tend to be linear and have simple chains of a handful of prompts and API calls without much branching or decision-making. +While many AI applications are limited to simple, linear chains of prompts and API calls with minimal branching, Julep is built to handle more complex scenarios. + +It supports: +- Intricate, multi-step processes +- Dynamic decision-making +- Parallel execution > [!TIP] -> Imagine you want to build an AI agent that can do more than just answer simple queriesโ€”it needs to handle complex tasks, remember past interactions, and maybe even integrate with other tools or APIs. That's where Julep comes in. +> Imagine you want to build an AI agent that can do more than just answer simple questionsโ€”it needs to handle complex tasks, remember past interactions, and maybe even use other tools or APIs. That's where Julep comes in. ## Quick Example @@ -119,13 +131,10 @@ Imagine a Research AI agent that can do the following: 1. Take a topic, 2. Come up with 100 search queries for that topic, 3. Perform those web searches in parallel, - 4. Collect and compile the results, - 5. Come up with 5 follow-up questions, - 6. Repeat the process with new queries, - 7. Summarize the results, - 8. Send the summary to Discord + 4. Summarize the results, + 5. Send the summary to Discord -In julep, this would be a single task under 80 lines of code and run fully managed all on its own. Here's a working example: +In Julep, this would be a single task under 80 lines of code and run fully managed all on its own. All of the steps are executed on Julep's own servers and you don't need to lift a finger. Here's a working example: ```yaml name: Research Agent @@ -182,45 +191,19 @@ main: tool: web_search arguments: query: "_" - on_error: parallelism: 100 # Collect the results from the web search - evaluate: results: "'\n'.join([item.result for item in _])" -# Generate follow-up questions based on the results -- prompt: - - role: system - content: >- - Based on the following research results, generate 5 follow-up questions that would deepen our understanding of {{inputs[0].topic}}: - {{_.results}} - - Write one question per line. - unwrap: true - -- evaluate: - follow_up_queries: "_.split('\n')" - -# Run the web search in parallel for each follow-up query -- over: "_.follow_up_queries" - map: - tool: web_search - arguments: - query: "_" - - parallelism: 5 - -- evaluate: - all_results: "outputs[3].results + '\n'.join([item.result for item in _])" - # Summarize the results - prompt: - role: system content: > You are a research summarizer. Create a comprehensive summary of the following research results on the topic {{inputs[0].topic}}. The summary should be well-structured, informative, and highlight key findings and insights: - {{_.all_results}} + {{_.results}} unwrap: true # Send the summary to Discord @@ -235,17 +218,17 @@ main: > [!TIP] > Julep is really useful when you want to build AI agents that can maintain context and state over long-term interactions. It's great for designing complex, multi-step workflows and integrating various tools and APIs directly into your agent's processes. > -> In this example, Julep will automatically manage parallel executions, retry failed steps, resend api requests, and keep the workflows running reliably until completion. +> In this example, Julep will automatically manage parallel executions, retry failed steps, resend API requests, and keep the tasks running reliably until completion. ## Key Features -1. **Persistent AI Agents**: Persist context and state over long-term interactions. -2. **Stateful Sessions**: Remember past interactions for personalized responses. -3. **Multi-Step Workflows**: Build complex, multi-step processes with loops and conditional logic. -4. **Task Orchestration**: Manage long-running tasks that can run indefinitely. -5. **Built-in Tools**: Integrate built-in tools and external APIs into workflows. -6. **Self-Healing**: Julep will automatically retry failed steps, resend messages, and generally keep your workflows running smoothly. -7. **RAG**: Use Julep's document store to build a RAG system for your own data. +1. ๐Ÿง  **Persistent AI Agents**: Remember context and information over long-term interactions. +2. ๐Ÿ’พ **Stateful Sessions**: Keep track of past interactions for personalized responses. +3. ๐Ÿ”„ **Multi-Step Tasks**: Build complex, multi-step processes with loops and decision-making. +4. โณ **Task Management**: Handle long-running tasks that can run indefinitely. +5. ๐Ÿ› ๏ธ **Built-in Tools**: Use built-in tools and external APIs in your tasks. +6. ๐Ÿ”ง **Self-Healing**: Julep will automatically retry failed steps, resend messages, and generally keep your tasks running smoothly. +7. ๐Ÿ“š **RAG**: Use Julep's document store to build a system for retrieving and using your own data. Julep is ideal for applications that require AI use cases beyond simple prompt-response models. @@ -255,34 +238,34 @@ Julep is ideal for applications that require AI use cases beyond simple prompt-r Think of LangChain and Julep as tools with different focuses within the AI development stack. -LangChain is great for creating sequences of prompts and managing interactions with LLMs. It has a large ecosystem with lots of pre-built integrations, which makes it convenient if you want to get something up and running quickly. LangChain fits well with simple use cases that involve a linear chain of prompts and API calls. +LangChain is great for creating sequences of prompts and managing interactions with AI models. It has a large ecosystem with lots of pre-built integrations, which makes it convenient if you want to get something up and running quickly. LangChain fits well with simple use cases that involve a linear chain of prompts and API calls. -Julep, on the other hand, is more about building persistent AI agents that can maintain context over long-term interactions. It shines when you need complex workflows that involve multi-step tasks, conditional logic, and integration with various tools or APIs directly within the agent's process. It's designed from the ground up to manage persistent sessions and complex workflows. +Julep, on the other hand, is more about building persistent AI agents that can remember things over long-term interactions. It shines when you need complex tasks that involve multiple steps, decision-making, and integration with various tools or APIs directly within the agent's process. It's designed from the ground up to manage persistent sessions and complex tasks. Use Julep if you imagine building a complex AI assistant that needs to: - Keep track of user interactions over days or weeks. - Perform scheduled tasks, like sending daily summaries or monitoring data sources. - Make decisions based on prior interactions or stored data. -- Interact with multiple external services as part of its workflow. +- Interact with multiple external services as part of its task. Then Julep provides the infrastructure to support all that without you having to build it from scratch. ### Different Form Factor -Julep is a **platform** that includes a language for describing workflows, a server for running those workflows, and an SDK for interacting with the platform. In order to build something with Julep, you write a description of the workflow in `YAML`, and then run the workflow in the cloud. +Julep is a **platform** that includes a language for describing tasks, a server for running those tasks, and an SDK for interacting with the platform. To build something with Julep, you write a description of the task in `YAML`, and then run the task in the cloud. -Julep is built for heavy-lifting, multi-step, and long-running workflows and there's no limit to how complex the workflow can be. +Julep is built for heavy-lifting, multi-step, and long-running tasks and there's no limit to how complex the task can be. -LangChain is a **library** that includes a few tools and a framework for building linear chains of prompts and tools. In order to build something with LangChain, you typically write Python code that configures and runs the model chains you want to use. +LangChain is a **library** that includes a few tools and a framework for building linear chains of prompts and tools. To build something with LangChain, you typically write Python code that configures and runs the model chains you want to use. LangChain might be sufficient and quicker to implement for simple use cases that involve a linear chain of prompts and API calls. ### In Summary -Use LangChain when you need to manage LLM interactions and prompt sequences in a stateless or short-term context. +Use LangChain when you need to manage AI model interactions and prompt sequences in a stateless or short-term context. -Choose Julep when you need a robust framework for stateful agents with advanced workflow capabilities, persistent sessions, and complex task orchestration. +Choose Julep when you need a robust framework for stateful agents with advanced task capabilities, persistent sessions, and complex task management. ## Installation @@ -598,7 +581,7 @@ Julep is made up of the following components: ### Mental Model
- +
Think of Julep as a platform that combines both client-side and server-side components to help you build advanced AI agents. Here's how to visualize it: @@ -662,55 +645,137 @@ Tasks are the core of Julep's workflow system. They allow you to define complex, ### Types of Workflow Steps -Tasks in Julep can include various types of steps: +Tasks in Julep can include various types of steps, allowing you to create complex and powerful workflows. Here's an overview of the available step types, organized by category: + +#### Common Steps 1. **Prompt**: Send a message to the AI model and receive a response. - ```python - {"prompt": "Analyze the following data: {{data}}"} + ```yaml + - prompt: "Analyze the following data: {{data}}" ``` 2. **Tool Call**: Execute an integrated tool or API. - ```python - {"tool": "web_search", "arguments": {"query": "Latest AI developments"}} + ```yaml + - tool: web_search + arguments: + query: "Latest AI developments" ``` 3. **Evaluate**: Perform calculations or manipulate data. - ```python - {"evaluate": {"average_score": "sum(scores) / len(scores)"}} + ```yaml + - evaluate: + average_score: "sum(scores) / len(scores)" ``` -4. **Conditional Logic**: Execute steps based on conditions. - ```python - {"if": "score > 0.8", "then": [...], "else": [...]} +4. **Wait for Input**: Pause workflow until input is received. + ```yaml + - wait_for_input: + info: + message: "Please provide additional information." ``` -5. **Loops**: Iterate over data or repeat steps. - ```python - {"foreach": {"in": "data_list", "do": [...]}} +5. **Log**: Log a specified value or message. + ```yaml + - log: "Processing completed for item {{item_id}}" + ``` + +#### Key-Value Steps + +6. **Get**: Retrieve a value from a key-value store. + ```yaml + - get: "user_preference" ``` -| Step Name | Description | Input | -|--------------------|--------------------------------------------------------------------------------------------------|------------------------------------------------------| -| **Prompt** | Send a message to the AI model and receive a response. | Prompt text or template | -| **Tool Call** | Execute an integrated tool or API. | Tool name and arguments | -| **Evaluate** | Perform calculations or manipulate data. | Expressions or variables to evaluate | -| **Wait for Input** | Pause workflow until input is received. | Any required user or system input | -| **Log** | Log a specified value or message. | Message or value to log | -| **Embed** | Embed text into a specific format or system. | Text or content to embed | -| **Search** | Perform a document search based on a query. | Search query | -| **Get** | Retrieve a value from a key-value store. | Key identifier | -| **Set** | Assign a value to a key in a key-value store. | Key and value to assign | -| **Parallel** | Run multiple steps in parallel. | List of steps to execute simultaneously | -| **Foreach** | Iterate over a collection and perform steps for each item. | Collection or list to iterate over | -| **MapReduce** | Map over a collection and reduce the results based on an expression. | Collection to map and reduce expressions | -| **If Else** | Conditional execution of steps based on a condition. | Condition to evaluate | -| **Switch** | Execute steps based on multiple conditions, similar to a switch-case statement. | Multiple conditions and corresponding steps | -| **Yield** | Run a subworkflow and await its completion. | Subworkflow identifier and input data | -| **Error** | Handle errors by specifying an error message. | Error message or handling instructions | -| **Sleep** | Pause the workflow for a specified duration. | Duration (seconds, minutes, etc.) | -| **Return** | Return a value from the workflow. | Value to return | - -For detailed information on each step type and advanced usage, please refer to our [Task Documentation](https://docs.julep.ai/tasks). +7. **Set**: Assign a value to a key in a key-value store. + ```yaml + - set: + user_preference: "dark_mode" + ``` + +#### Iteration Steps + +8. **Foreach**: Iterate over a collection and perform steps for each item. + ```yaml + - foreach: + in: "data_list" + do: + - log: "Processing item {{_}}" + ``` + +9. **Map-Reduce**: Map over a collection and reduce the results. + ```yaml + - map_reduce: + over: "numbers" + map: + - evaluate: + squared: "_ ** 2" + reduce: "sum(results)" + ``` + +10. **Parallel**: Run multiple steps in parallel. + ```yaml + - parallel: + - tool: web_search + arguments: + query: "AI news" + - tool: weather_check + arguments: + location: "New York" + ``` + +#### Conditional Steps + +11. **If-Else**: Conditional execution of steps. + ```yaml + - if: "score > 0.8" + then: + - log: "High score achieved" + else: + - log: "Score needs improvement" + ``` + +12. **Switch**: Execute steps based on multiple conditions. + ```yaml + - switch: + - case: "category == 'A'" + then: + - log: "Category A processing" + - case: "category == 'B'" + then: + - log: "Category B processing" + - case: "_" # Default case + then: + - log: "Unknown category" + ``` + +#### Other Control Flow + +13. **Sleep**: Pause the workflow for a specified duration. + ```yaml + - sleep: + seconds: 30 + ``` + +14. **Return**: Return a value from the workflow. + ```yaml + - return: + result: "Task completed successfully" + ``` + +15. **Yield**: Run a subworkflow and await its completion. + ```yaml + - yield: + workflow: "data_processing_subflow" + arguments: + input_data: "{{raw_data}}" + ``` + +16. **Error**: Handle errors by specifying an error message. + ```yaml + - error: "Invalid input provided" + ``` + +Each step type serves a specific purpose in building sophisticated AI workflows. This categorization helps in understanding the various control flows and operations available in Julep tasks. ## Advanced Features @@ -772,6 +837,98 @@ results = client.documents.search( For more advanced features and detailed usage, please refer to our [Advanced Features Documentation](https://docs.julep.ai/advanced-features). +## Integrations + +Julep supports various integrations that extend the capabilities of your AI agents. Here's a list of available integrations and their supported arguments: + +### Brave Search + +```yaml +setup: + api_key: string # The API key for Brave Search + +arguments: + query: string # The search query for searching with Brave + +output: + result: string # The result of the Brave Search +``` + +### BrowserBase + +```yaml +setup: + api_key: string # The API key for BrowserBase + project_id: string # The project ID for BrowserBase + session_id: string # (Optional) The session ID for BrowserBase + +arguments: + urls: list[string] # The URLs for loading with BrowserBase + +output: + documents: list # The documents loaded from the URLs +``` + +### Email + +```yaml +setup: + host: string # The host of the email server + port: integer # The port of the email server + user: string # The username of the email server + password: string # The password of the email server + +arguments: + to: string # The email address to send the email to + from: string # The email address to send the email from + subject: string # The subject of the email + body: string # The body of the email + +output: + success: boolean # Whether the email was sent successfully +``` + +### Spider + +```yaml +setup: + spider_api_key: string # The API key for Spider + +arguments: + url: string # The URL for which to fetch data + mode: string # The type of crawlers (default: "scrape") + params: dict # (Optional) The parameters for the Spider API + +output: + documents: list # The documents returned from the spider +``` + +### Weather + +```yaml +setup: + openweathermap_api_key: string # The API key for OpenWeatherMap + +arguments: + location: string # The location for which to fetch weather data + +output: + result: string # The weather data for the specified location +``` + +### Wikipedia + +```yaml +arguments: + query: string # The search query string + load_max_docs: integer # Maximum number of documents to load (default: 2) + +output: + documents: list # The documents returned from the Wikipedia search +``` + +These integrations can be used within your tasks to extend the capabilities of your AI agents. For more detailed information on how to use these integrations in your workflows, please refer to our [Integrations Documentation](https://docs.julep.ai/integrations). + ## SDK Reference - [Node.js SDK](https://github.com/julep-ai/node-sdk/blob/main/api.md) @@ -783,4 +940,4 @@ Explore our comprehensive API documentation to learn more about agents, tasks, a - [Agents API](https://api.julep.ai/api/docs#tag/agents) - [Tasks API](https://api.julep.ai/api/docs#tag/tasks) -- [Executions API](https://api.julep.ai/api/docs#tag/executions) +- [Executions API](https://api.julep.ai/api/docs#tag/executions) \ No newline at end of file diff --git a/SCRATCHPAD.md b/SCRATCHPAD.md new file mode 100644 index 000000000..f793fb367 --- /dev/null +++ b/SCRATCHPAD.md @@ -0,0 +1,137 @@ +Sure! So imagine you want to build an AI agent that can do more than just answer simple queriesโ€”it needs to handle complex tasks, remember past interactions, and maybe even integrate with other tools or APIs. That's where Julep comes in. It's an open-source platform that lets you create persistent AI agents with customizable workflows, making it super easy to develop and deploy advanced AI applications without reinventing the wheel. + + + +Julep is really useful when you want to build AI agents that can maintain context and state over long-term interactions. It's great for designing complex, multi-step workflows and integrating various tools and APIs directly into your agent's processes. + +Compared to LangChain, which is excellent for chaining together prompts and managing LLM interactions, Julep focuses more on creating persistent agents with customizable workflows. While LangChain provides a robust framework for building applications with language models, it doesn't inherently offer the same level of session management or state persistence that Julep does. + + + + + +Persistent sessions in Julep mean that the AI agents can maintain context and state over long periods and multiple interactions. So instead of just handling a single query and forgetting everything afterward (which is what you'd get with regular sessions), the agent can remember past conversations, user preferences, and any relevant data from previous interactions. This is super handy when you want your agent to provide a more personalized experience or when the tasks require building upon previous steps. + +For example, if you're building a customer support agent, it can recall a user's issue from earlier chats without them having to repeat themselves. Regular sessions typically don't offer this level of continuity. + +As for complex workflows, Julep lets you define multi-step tasks that can include conditional logic, loops, parallel processing, and integration with external tools or APIs. Regular workflows might be more linear and straightforwardโ€”think a simple sequence of prompts or API calls without much branching or decision-making capability. + +In Julep, you can create tasks where the agent might, say, take user input, perform a web search, process the results, maybe even interact with other services like sending an email or updating a databaseโ€”all within a single workflow. This level of complexity allows you to build more sophisticated applications without having to manage the orchestration logic yourself. + +That said, one thing to keep in mind is that while Julep offers these advanced features, it's still relatively new compared to something like LangChain. So you might find that the community support and pre-built integrations aren't as extensive yet. If you need something up and running quickly with lots of existing modules, LangChain might be more convenient. But if you want more control over persistent state and complex task execution, Julep provides a solid framework for that. + + + + + + +LangChain is great for creating sequences of prompts and managing interactions with LLMs. It has a large ecosystem with lots of pre-built integrations, which makes it convenient if you want to get something up and running quickly. + +Julep, on the other hand, is more about building persistent AI agents that can maintain context over long-term interactions. It shines when you need complex workflows that involve multi-step tasks, conditional logic, and integration with various tools or APIs directly within the agent's process. + +So, you shouldn't think of Julep as a direct replacement for LangChain. Instead, consider it as an alternative that's better suited for projects where maintaining state over time and handling complex task executions are important. If your application requires agents that can remember past interactions, personalize responses, and perform intricate operations, Julep might be the way to go. + + + + +Think of LangChain and Julep as tools with different focuses within the AI development stack. + +LangChain is like a powerful library that helps you chain together prompts and manage interactions with language models. It's excellent for building applications where the primary interaction is between the user and the LLM in a sequential manner. You get utilities for prompt management, memory, and even some basic tools integration. But when it comes to handling more complex state management or long-term sessions, you might find yourself writing a lot of custom code. + +Julep, on the other hand, is more of an orchestration platform for AI agents. It's designed from the ground up to manage persistent sessions and complex workflows. Here's how you might think about it: + +Persistent State and Sessions: Julep allows your AI agents to maintain state over time without you having to implement the storage and retrieval mechanisms yourself. So if your application requires the agent to remember previous interactions, user preferences, or intermediate data across sessions, Julep handles that natively. + +Complex Workflow Management: With Julep, you can define multi-step tasks that include conditional logic, loops, parallel processing, and more. It's like having a built-in workflow engine tailored for AI agents. This is particularly useful when your agent needs to perform a series of actions that depend on each other or on external inputs. + +Tool and API Integration: While LangChain allows for some tools integration, Julep provides a more seamless way to incorporate external tools and APIs directly into your agent's workflows. You can define tools once and reuse them across different tasks and agents. + +Agent-Centric Design: Julep is centered around the concept of agents that have their own identities, abilities, and long-term goals. This abstraction is helpful when you're building applications where the agent needs to interact with users or systems in a more autonomous or stateful way. + +So, rather than a drop-in replacement, Julep can be thought of as a higher-level framework that sits on top of or alongside tools like LangChain. If you imagine building a complex AI assistant that needs to: + +Keep track of user interactions over days or weeks. +Perform scheduled tasks, like sending daily summaries or monitoring data sources. +Make decisions based on prior interactions or stored data. +Interact with multiple external services as part of its workflow. +Then Julep provides the infrastructure to support all that without you having to build it from scratch. + +In contrast, if you're building a simpler application where you just need to chain a few prompts together and don't require persistent state or complex task management, LangChain might be sufficient and quicker to implement. + +In summary: + +Use LangChain when you need to manage LLM interactions and prompt sequences in a stateless or short-term context. +Choose Julep when you need a robust framework for stateful agents with advanced workflow capabilities, persistent sessions, and complex task orchestration. + + + + +Sure! To help you "bookmark" Julep in your mind, here are some key phrases and keywords that set it apart and highlight where it uniquely shines: + +Persistent AI Agents: Julep specializes in creating AI agents that maintain context and state over long-term interactions. + +Stateful Sessions: Think of Julep when you need sessions that remember past interactions, enabling personalized and context-aware responses. + +Customizable Workflows: It's ideal for building complex, multi-step workflows with features like conditional logic, loops, and parallel processing. + +Advanced Task Orchestration: Julep excels at orchestrating intricate tasks without requiring you to build the orchestration logic from scratch. + +Seamless Tool and API Integration: Use Julep when you want to integrate external tools and APIs directly into your agent's workflows. + +Agent-Centric Design: It's designed around autonomous agents with their own identities and long-term goals, perfect for applications needing more than simple prompt-response interactions. + +Reason to Recall Julep: + +When you're working on a project that requires an AI agent to: + +Maintain Long-Term Context: Remember user preferences or past interactions over extended periods. + +Handle Complex Operations: Perform multi-step tasks that involve decision-making, branching logic, or interacting with multiple services. + +Integrate with External Systems: Seamlessly connect with APIs, databases, or other tools as part of the agent's workflow. + +Provide Personalized Experiences: Offer responses or actions tailored to individual users based on accumulated context. + +In these scenarios, Julep uniquely shines by providing the infrastructure and tools needed to build such sophisticated, stateful AI applications without having to build the underlying systems yourself. + + + + + + +Possible Descriptions: + +"Julep is an open-source platform for building persistent AI agents that maintain long-term context and execute complex, customizable workflows." + +"Create AI agents that remember past interactions and handle intricate tasks with Julep's customizable workflows and seamless tool integration." + +"Julep enables developers to build stateful AI agents with advanced task orchestration, maintaining context over time and integrating external tools directly into workflows." + +"With Julep, develop AI agents that persist over sessions, perform multi-step tasks, and integrate various tools and APIs effortlessly." + +"Julep is a platform for creating AI agents that maintain state and execute complex workflows, offering long-term context and advanced orchestration capabilities." + + + + +Key Concepts to Include: + +Persistent AI Agents: Agents that maintain context and state over long-term interactions. +Customizable Workflows: Ability to define complex, multi-step tasks with conditional logic, loops, and more. +Seamless Tool and API Integration: Direct integration of external tools and APIs into agents' workflows. +Stateful Sessions: Sessions that remember past interactions for personalized and context-aware responses. +Advanced Task Orchestration: Orchestrate intricate tasks without building the underlying logic from scratch. + + + +Top 5 Winners +1.5 "Julep: Open-source platform for AI agents with long-term memory and complex workflows." + +2.5 "Julep: Create AI agents that remember and handle intricate tasks effortlessly." + +3.5 "Julep: Create AI agents with persistent context and advanced orchestration." + +4.5 "Julep: Craft AI agents that persist and perform complex tasks seamlessly." + +5.5 "Julep: Build AI agents with persistent state and powerful task execution." + diff --git a/agents-api/agents_api/models/user/create_or_update_user.py b/agents-api/agents_api/models/user/create_or_update_user.py index d295d1d8a..13260a038 100644 --- a/agents-api/agents_api/models/user/create_or_update_user.py +++ b/agents-api/agents_api/models/user/create_or_update_user.py @@ -26,9 +26,21 @@ @rewrap_exceptions( { - QueryException: partialclass(HTTPException, status_code=400), - ValidationError: partialclass(HTTPException, status_code=400), - TypeError: partialclass(HTTPException, status_code=400), + QueryException: partialclass( + HTTPException, + status_code=400, + detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect.", + ), + ValidationError: partialclass( + HTTPException, + status_code=400, + detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format.", + ), + TypeError: partialclass( + HTTPException, + status_code=400, + detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again.", + ), } ) @wrap_in_class(User, one=True, transform=lambda d: {"id": UUID(d.pop("user_id")), **d}) diff --git a/agents-api/agents_api/models/user/create_user.py b/agents-api/agents_api/models/user/create_user.py index 9dd036c57..270c0d44c 100644 --- a/agents-api/agents_api/models/user/create_user.py +++ b/agents-api/agents_api/models/user/create_user.py @@ -29,11 +29,24 @@ lambda e: isinstance(e, QueryException) and "asserted to return some results, but returned none" in str(e): lambda *_: HTTPException( - detail="developer not found", status_code=403 + detail="Developer not found. Please ensure the provided auth token (which refers to your developer_id) is valid and the developer has the necessary permissions to create an agent.", + status_code=403, + ), + QueryException: partialclass( + HTTPException, + status_code=400, + detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect.", + ), + ValidationError: partialclass( + HTTPException, + status_code=400, + detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format.", + ), + TypeError: partialclass( + HTTPException, + status_code=400, + detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again.", ), - QueryException: partialclass(HTTPException, status_code=400), - ValidationError: partialclass(HTTPException, status_code=400), - TypeError: partialclass(HTTPException, status_code=400), } ) @wrap_in_class( diff --git a/agents-api/agents_api/models/user/delete_user.py b/agents-api/agents_api/models/user/delete_user.py index 0532f5cfa..7f08316be 100644 --- a/agents-api/agents_api/models/user/delete_user.py +++ b/agents-api/agents_api/models/user/delete_user.py @@ -27,9 +27,32 @@ @rewrap_exceptions( { - QueryException: partialclass(HTTPException, status_code=400), - ValidationError: partialclass(HTTPException, status_code=400), - TypeError: partialclass(HTTPException, status_code=400), + lambda e: isinstance(e, QueryException) + and "Developer does not exist" in str(e): lambda *_: HTTPException( + detail="The specified developer does not exist.", + status_code=403, + ), + lambda e: isinstance(e, QueryException) + and "Developer does not own resource" + in e.resp["display"]: lambda *_: HTTPException( + detail="The specified developer does not own the requested resource. Please verify the ownership or check if the developer ID is correct.", + status_code=404, + ), + QueryException: partialclass( + HTTPException, + status_code=400, + detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect.", + ), + ValidationError: partialclass( + HTTPException, + status_code=400, + detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format.", + ), + TypeError: partialclass( + HTTPException, + status_code=400, + detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again.", + ), } ) @wrap_in_class( diff --git a/agents-api/agents_api/models/user/get_user.py b/agents-api/agents_api/models/user/get_user.py index 2b4f59c83..34ff2c6f4 100644 --- a/agents-api/agents_api/models/user/get_user.py +++ b/agents-api/agents_api/models/user/get_user.py @@ -23,17 +23,31 @@ @rewrap_exceptions( { lambda e: isinstance(e, QueryException) - and "Developer not found" in str(e): lambda *_: HTTPException( - detail="developer does not exist", status_code=403 + and "Developer does not exist" in str(e): lambda *_: HTTPException( + detail="The specified developer does not exist.", + status_code=403, ), lambda e: isinstance(e, QueryException) and "Developer does not own resource" in e.resp["display"]: lambda *_: HTTPException( - detail="developer doesnt own resource", status_code=404 + detail="The specified developer does not own the requested resource. Please verify the ownership or check if the developer ID is correct.", + status_code=404, + ), + QueryException: partialclass( + HTTPException, + status_code=400, + detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect.", + ), + ValidationError: partialclass( + HTTPException, + status_code=400, + detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format.", + ), + TypeError: partialclass( + HTTPException, + status_code=400, + detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again.", ), - QueryException: partialclass(HTTPException, status_code=400), - ValidationError: partialclass(HTTPException, status_code=400), - TypeError: partialclass(HTTPException, status_code=400), } ) @wrap_in_class(User, one=True) diff --git a/agents-api/agents_api/models/user/list_users.py b/agents-api/agents_api/models/user/list_users.py index 2a810b8e0..7f59cbf57 100644 --- a/agents-api/agents_api/models/user/list_users.py +++ b/agents-api/agents_api/models/user/list_users.py @@ -22,9 +22,21 @@ @rewrap_exceptions( { - QueryException: partialclass(HTTPException, status_code=400), - ValidationError: partialclass(HTTPException, status_code=400), - TypeError: partialclass(HTTPException, status_code=400), + QueryException: partialclass( + HTTPException, + status_code=400, + detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect.", + ), + ValidationError: partialclass( + HTTPException, + status_code=400, + detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format.", + ), + TypeError: partialclass( + HTTPException, + status_code=400, + detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again.", + ), } ) @wrap_in_class(User) diff --git a/agents-api/agents_api/models/user/patch_user.py b/agents-api/agents_api/models/user/patch_user.py index 265241d47..152f66de7 100644 --- a/agents-api/agents_api/models/user/patch_user.py +++ b/agents-api/agents_api/models/user/patch_user.py @@ -26,9 +26,21 @@ @rewrap_exceptions( { - QueryException: partialclass(HTTPException, status_code=400), - ValidationError: partialclass(HTTPException, status_code=400), - TypeError: partialclass(HTTPException, status_code=400), + QueryException: partialclass( + HTTPException, + status_code=400, + detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect.", + ), + ValidationError: partialclass( + HTTPException, + status_code=400, + detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format.", + ), + TypeError: partialclass( + HTTPException, + status_code=400, + detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again.", + ), } ) @wrap_in_class( diff --git a/agents-api/agents_api/models/user/update_user.py b/agents-api/agents_api/models/user/update_user.py index fd8e7e2c8..964e550b4 100644 --- a/agents-api/agents_api/models/user/update_user.py +++ b/agents-api/agents_api/models/user/update_user.py @@ -23,9 +23,21 @@ @rewrap_exceptions( { - QueryException: partialclass(HTTPException, status_code=400), - ValidationError: partialclass(HTTPException, status_code=400), - TypeError: partialclass(HTTPException, status_code=400), + QueryException: partialclass( + HTTPException, + status_code=400, + detail="A database query failed to return the expected results. This might occur if the requested resource doesn't exist or your query parameters are incorrect.", + ), + ValidationError: partialclass( + HTTPException, + status_code=400, + detail="Input validation failed. Please check the provided data for missing or incorrect fields, and ensure it matches the required format.", + ), + TypeError: partialclass( + HTTPException, + status_code=400, + detail="A type mismatch occurred. This likely means the data provided is of an incorrect type (e.g., string instead of integer). Please review the input and try again.", + ), } ) @wrap_in_class( diff --git a/docs/api-reference/README.md b/docs/api-reference/README.md index ed15fbb56..133cd82dc 100644 --- a/docs/api-reference/README.md +++ b/docs/api-reference/README.md @@ -1,3 +1,11 @@ + +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + # Agents API [![Run In Postman](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/33213061-a0a1e3a9-9681-44ae-a5c2-703912b32336?action=collection%2Ffork\&source=rip\_markdown\&collection-url=entityId%3D33213061-a0a1e3a9-9681-44ae-a5c2-703912b32336%26entityType%3Dcollection%26workspaceId%3D183380b4-f2ac-44ef-b018-1f65dfc8256b) diff --git a/docs/api-reference/agents-api-1.md b/docs/api-reference/agents-api-1.md index 2f154610a..b5f4ac824 100644 --- a/docs/api-reference/agents-api-1.md +++ b/docs/api-reference/agents-api-1.md @@ -2,6 +2,14 @@ description: API for creating and modifying Users --- +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + + # Users ## List all users diff --git a/docs/api-reference/agents-api-2.md b/docs/api-reference/agents-api-2.md index 35a3f3000..61f601336 100644 --- a/docs/api-reference/agents-api-2.md +++ b/docs/api-reference/agents-api-2.md @@ -2,6 +2,13 @@ description: API for creating and modifying Sessions --- +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + # Sessions ## List sessions diff --git a/docs/api-reference/agents-api-3.md b/docs/api-reference/agents-api-3.md index 8ef294087..7485ba93e 100644 --- a/docs/api-reference/agents-api-3.md +++ b/docs/api-reference/agents-api-3.md @@ -2,6 +2,13 @@ description: API for accessing Agent Memories --- +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + # Memories ## Get an agent's memories diff --git a/docs/api-reference/agents-api-4.md b/docs/api-reference/agents-api-4.md index 0cab8dad9..863363b5a 100644 --- a/docs/api-reference/agents-api-4.md +++ b/docs/api-reference/agents-api-4.md @@ -2,6 +2,13 @@ description: API for creating and modifying docs --- +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + # Docs ## Get all docs (for an agent or user) diff --git a/docs/api-reference/agents-api-5.md b/docs/api-reference/agents-api-5.md index 86c29ae67..a1bb28348 100644 --- a/docs/api-reference/agents-api-5.md +++ b/docs/api-reference/agents-api-5.md @@ -1,6 +1,13 @@ # Tasks +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + {% hint style="info" %} Coming Soon diff --git a/docs/api-reference/agents-api-6.md b/docs/api-reference/agents-api-6.md index f5f5bc7ed..44581cd22 100644 --- a/docs/api-reference/agents-api-6.md +++ b/docs/api-reference/agents-api-6.md @@ -1,5 +1,12 @@ # Task Runs +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + {% hint style="info" %} **Coming soon.** {% endhint %} diff --git a/docs/api-reference/agents-api.md b/docs/api-reference/agents-api.md index 783a75e74..08792d15f 100644 --- a/docs/api-reference/agents-api.md +++ b/docs/api-reference/agents-api.md @@ -2,6 +2,13 @@ description: API for creating and modifying Agents --- +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + # Agents ## List agents diff --git a/docs/concepts/agents.md b/docs/concepts/agents.md index c2a42f9d3..1283aadb6 100644 --- a/docs/concepts/agents.md +++ b/docs/concepts/agents.md @@ -2,6 +2,13 @@ description: A fundamental building block of an AI app built using Julep. --- +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + # ๐Ÿค– Agents ## What is an Agent? diff --git a/docs/concepts/documents.md b/docs/concepts/documents.md index 9509677ae..4db791567 100644 --- a/docs/concepts/documents.md +++ b/docs/concepts/documents.md @@ -2,6 +2,13 @@ description: Documents to be added for Retrieval Augmented Generation --- +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + # ๐Ÿ“– Documents A typical RAG application has the following components: diff --git a/docs/concepts/sessions/README.md b/docs/concepts/sessions/README.md index 905665736..f8f01d501 100644 --- a/docs/concepts/sessions/README.md +++ b/docs/concepts/sessions/README.md @@ -2,6 +2,13 @@ description: A conversation "session" between a user and an agent. --- +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + # ๐Ÿ” Sessions ## What is a Session? diff --git a/docs/concepts/sessions/adaptive-context.md b/docs/concepts/sessions/adaptive-context.md index 8bb7cf801..dba2df0fe 100644 --- a/docs/concepts/sessions/adaptive-context.md +++ b/docs/concepts/sessions/adaptive-context.md @@ -1,5 +1,12 @@ # Adaptive Context แดบแดฑแต‚ +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + ### What is Adaptive Context? Adaptive Context is a feature in Julep that intelligently manages the context size for long-running sessions. It allows users to continue adding messages to a session indefinitely without worrying about hitting context window limits or incurring excessive costs. diff --git a/docs/concepts/users.md b/docs/concepts/users.md index a15eed32c..15b3d4f51 100644 --- a/docs/concepts/users.md +++ b/docs/concepts/users.md @@ -2,6 +2,13 @@ description: A real person or system that needs to interacts with the Agent in your app. --- +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + # ๐Ÿ™Ž Users ## What is a User? diff --git a/docs/explanation/chat_features.md b/docs/explanation/chat_features.md index a3e4bf0eb..23aad265c 100644 --- a/docs/explanation/chat_features.md +++ b/docs/explanation/chat_features.md @@ -1,5 +1,12 @@ # Chat Features in Julep +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + Julep provides a robust chat system with various features for dynamic interaction with agents. Here's an overview of the key components and functionalities: ## Chat Input diff --git a/docs/explanation/context_overflow.md b/docs/explanation/context_overflow.md index 5176db2dc..5b87811c4 100644 --- a/docs/explanation/context_overflow.md +++ b/docs/explanation/context_overflow.md @@ -1,5 +1,12 @@ # Context Overflow Handling in Julep +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + Julep provides mechanisms to handle scenarios where the context size grows beyond the `token_budget` or the model's input limit. The behavior is determined by the `context_overflow` setting: 1. `null` (default): diff --git a/docs/explanation/core_concepts.md b/docs/explanation/core_concepts.md index a291aeedf..c8a29f0fd 100644 --- a/docs/explanation/core_concepts.md +++ b/docs/explanation/core_concepts.md @@ -1,5 +1,12 @@ # Core Concepts in Julep +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + Julep is a powerful backend system for managing agent execution. It provides several key components that work together to create flexible and intelligent applications. Here are the core concepts: ## Agent diff --git a/docs/explanation/default_system_template.md b/docs/explanation/default_system_template.md index 3d0f5d272..4ba74b2a9 100644 --- a/docs/explanation/default_system_template.md +++ b/docs/explanation/default_system_template.md @@ -1,5 +1,12 @@ # Default System Template in Julep +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + Julep uses a default system template for sessions when a custom one is not provided. This template is written in Jinja2 and incorporates various elements from the agent, user, and session context. Here's a breakdown of the template: ```jinja diff --git a/docs/explanation/execution_state_machine.md b/docs/explanation/execution_state_machine.md index 9acd2ccaf..648d514bd 100644 --- a/docs/explanation/execution_state_machine.md +++ b/docs/explanation/execution_state_machine.md @@ -1,5 +1,12 @@ # Execution State Machine in Julep +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + In Julep, an Execution represents an instance of a Task that has been started with some input. The Execution follows a specific state machine model, ensuring consistent and predictable behavior throughout its lifecycle. ## Execution States diff --git a/docs/explanation/metadata_precedence.md b/docs/explanation/metadata_precedence.md index f704b1373..dd36ce0ce 100644 --- a/docs/explanation/metadata_precedence.md +++ b/docs/explanation/metadata_precedence.md @@ -1,5 +1,12 @@ # Metadata Precedence in Julep +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + In Julep, several objects can have `metadata` added to them: - Agent - User diff --git a/docs/explanation/multi_agent_sessions.md b/docs/explanation/multi_agent_sessions.md index b497c0fd2..72fa5d52a 100644 --- a/docs/explanation/multi_agent_sessions.md +++ b/docs/explanation/multi_agent_sessions.md @@ -1,5 +1,12 @@ # Multi-Agent Sessions in Julep +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + Julep supports different types of sessions based on the number of agents and users involved. This flexibility allows for complex interactions and use cases. ## Types of Sessions diff --git a/docs/explanation/task_workflows.md b/docs/explanation/task_workflows.md index 7c77ff686..847cb3157 100644 --- a/docs/explanation/task_workflows.md +++ b/docs/explanation/task_workflows.md @@ -1,5 +1,12 @@ # Task Workflows in Julep +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + Tasks in Julep are powerful, Github Actions-style workflows that define long-running, multi-step actions. They allow for complex operations by defining steps and have access to all Julep integrations. ## Task Structure diff --git a/docs/explanation/tool_integration.md b/docs/explanation/tool_integration.md index a0cfd4ae9..a3a71065a 100644 --- a/docs/explanation/tool_integration.md +++ b/docs/explanation/tool_integration.md @@ -1,5 +1,12 @@ # Tool Integration in Julep +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + Julep provides a flexible system for integrating various types of tools that agents can use during interactions. These tools enable agents to perform actions, retrieve information, or interact with external systems. ## Types of Tools diff --git a/docs/how-to-guides/customizing_tasks.md b/docs/how-to-guides/customizing_tasks.md index 29a39dd19..a5f845214 100644 --- a/docs/how-to-guides/customizing_tasks.md +++ b/docs/how-to-guides/customizing_tasks.md @@ -1,5 +1,12 @@ # Customizing Tasks +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This guide covers how to define and customize tasks for agents in Julep. ## Creating a Basic Task diff --git a/docs/how-to-guides/handling_executions.md b/docs/how-to-guides/handling_executions.md index 22aeedaa5..fca788642 100644 --- a/docs/how-to-guides/handling_executions.md +++ b/docs/how-to-guides/handling_executions.md @@ -1,5 +1,12 @@ # Handling Executions +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This guide covers how to manage and monitor task executions in Julep. ## Starting an Execution diff --git a/docs/how-to-guides/managing_users.md b/docs/how-to-guides/managing_users.md index 6bdb94bac..b1f47a016 100644 --- a/docs/how-to-guides/managing_users.md +++ b/docs/how-to-guides/managing_users.md @@ -1,5 +1,12 @@ # Managing Users +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This guide covers how to create, update, and delete users in Julep. ## Creating a User diff --git a/docs/how-to-guides/using_chat_features.md b/docs/how-to-guides/using_chat_features.md index 63423ff0c..d9aabceaa 100644 --- a/docs/how-to-guides/using_chat_features.md +++ b/docs/how-to-guides/using_chat_features.md @@ -1,5 +1,12 @@ # Using Chat Features +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This guide covers how to use the chat features in Julep for dynamic interactions with agents. ## Starting a Chat Session diff --git a/docs/introduction/getting_started.md b/docs/introduction/getting_started.md index 6aa590121..f273bb776 100644 --- a/docs/introduction/getting_started.md +++ b/docs/introduction/getting_started.md @@ -1,5 +1,12 @@ # Getting Started with Julep +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This guide will help you set up and start using the Julep API. ## Prerequisites diff --git a/docs/introduction/overview.md b/docs/introduction/overview.md index a914535b5..26c75bcdb 100644 --- a/docs/introduction/overview.md +++ b/docs/introduction/overview.md @@ -1,5 +1,12 @@ # Overview of Julep +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + Julep is a powerful backend system for managing agent execution and interactions. It provides a comprehensive set of features for creating and managing agents, users, sessions, tools, documents, tasks, and executions. ## Key Features diff --git a/docs/reference/api_endpoints/agent_endpoints.md b/docs/reference/api_endpoints/agent_endpoints.md index 692931bb2..8634b2098 100644 --- a/docs/reference/api_endpoints/agent_endpoints.md +++ b/docs/reference/api_endpoints/agent_endpoints.md @@ -1,5 +1,12 @@ # Agent Endpoints +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This document provides a reference for all Agent API endpoints in Julep. ## List Agents diff --git a/docs/reference/api_endpoints/doc_endpoints.md b/docs/reference/api_endpoints/doc_endpoints.md index c168ecac2..2971c1b50 100644 --- a/docs/reference/api_endpoints/doc_endpoints.md +++ b/docs/reference/api_endpoints/doc_endpoints.md @@ -1,5 +1,12 @@ # Doc Endpoints +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This document provides a reference for all Doc API endpoints in Julep. ## List Docs for a User diff --git a/docs/reference/api_endpoints/session_endpoints.md b/docs/reference/api_endpoints/session_endpoints.md index f7a649594..03bd7559d 100644 --- a/docs/reference/api_endpoints/session_endpoints.md +++ b/docs/reference/api_endpoints/session_endpoints.md @@ -1,5 +1,12 @@ # Session Endpoints +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This document provides a reference for all Session API endpoints in Julep. ## List Sessions diff --git a/docs/reference/api_endpoints/tool_endpoints.md b/docs/reference/api_endpoints/tool_endpoints.md index a0aeab36a..194713f1f 100644 --- a/docs/reference/api_endpoints/tool_endpoints.md +++ b/docs/reference/api_endpoints/tool_endpoints.md @@ -1,5 +1,12 @@ # Tool Endpoints +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This document provides a reference for all Tool API endpoints in Julep. ## List Tools for an Agent diff --git a/docs/reference/api_endpoints/user_endpoints.md b/docs/reference/api_endpoints/user_endpoints.md index 9242c7167..ac2578907 100644 --- a/docs/reference/api_endpoints/user_endpoints.md +++ b/docs/reference/api_endpoints/user_endpoints.md @@ -1,5 +1,12 @@ # User Endpoints +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This document provides a reference for all User API endpoints in Julep. ## List Users diff --git a/docs/tutorials/creating_your_first_agent.md b/docs/tutorials/creating_your_first_agent.md index a21d27b1d..ae79c1e11 100644 --- a/docs/tutorials/creating_your_first_agent.md +++ b/docs/tutorials/creating_your_first_agent.md @@ -1,5 +1,12 @@ # Creating Your First Agent +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This tutorial will guide you through the process of creating your first agent using the Julep API. ## Step 1: Prepare the Agent Data diff --git a/docs/tutorials/integrating_tools.md b/docs/tutorials/integrating_tools.md index 16889f4a6..2c3233d1a 100644 --- a/docs/tutorials/integrating_tools.md +++ b/docs/tutorials/integrating_tools.md @@ -1,5 +1,12 @@ # Integrating Tools +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This tutorial will show you how to integrate tools with your Julep agents. ## Creating a User-Defined Function Tool diff --git a/docs/tutorials/managing_sessions.md b/docs/tutorials/managing_sessions.md index 866484912..bffb301fd 100644 --- a/docs/tutorials/managing_sessions.md +++ b/docs/tutorials/managing_sessions.md @@ -1,5 +1,12 @@ # Managing Sessions +***** +> ### This docs site is currently under construction although this github README below should suffice for now. + +![](https://i.giphy.com/vR1dPIYzQmkRzLZk2w.webp) +***** + + This tutorial will guide you through creating and managing sessions with your Julep agents. ## Creating a Session diff --git a/example.js b/example.js new file mode 100644 index 000000000..df2bf0af8 --- /dev/null +++ b/example.js @@ -0,0 +1,130 @@ +const { Julep } = require('@julep/sdk'); +const yaml = require('js-yaml'); +const readline = require('readline'); + +const client = new Julep({ apiKey: 'your_julep_api_key' }); + +async function createAgent() { + const agent = await client.agents.create({ + name: "Storytelling Agent", + model: "gpt-4", + about: "You are a creative storytelling agent that can craft engaging stories and generate comic panels based on ideas.", + }); + + // ๐Ÿ› ๏ธ Add an image generation tool (DALLยทE) to the agent + await client.agents.tools.create(agent.id, { + name: "image_generator", + description: "Use this tool to generate images based on descriptions.", + integration: { + provider: "dalle", + method: "generate_image", + setup: { + api_key: "your_openai_api_key", + }, + }, + }); + + return agent; +} + +const taskYaml = ` +name: Story and Comic Creator +description: Create a story based on an idea and generate a 4-panel comic strip illustrating the story. + +main: + # Step 1: Generate a story and outline into 4 panels + - prompt: + - role: system + content: You are {{agent.name}}. {{agent.about}} + - role: user + content: > + Based on the idea '{{_.idea}}', write a short story suitable for a 4-panel comic strip. + Provide the story and a numbered list of 4 brief descriptions for each panel illustrating key moments in the story. + unwrap: true + + # Step 2: Extract the panel descriptions and story + - evaluate: + story: _.split('1. ')[0].trim() + panels: _.match(/\\d+\\.\\s*(.*?)(?=\\d+\\.\\s*|$)/g) + + # Step 3: Generate images for each panel using the image generator tool + - foreach: + in: _.panels + do: + tool: image_generator + arguments: + description: _ + + # Step 4: Generate a catchy title for the story + - prompt: + - role: system + content: You are {{agent.name}}. {{agent.about}} + - role: user + content: > + Based on the story below, generate a catchy title. + + Story: {{outputs[1].story}} + unwrap: true + + # Step 5: Return the story, the generated images, and the title + - return: + title: outputs[3] + story: outputs[1].story + comic_panels: outputs[2].map(output => output.image.url) +`; + +async function createTask(agent) { + const task = await client.tasks.create(agent.id, yaml.load(taskYaml)); + return task; +} + +async function executeTask(task) { + const execution = await client.executions.create(task.id, { + input: { idea: "A cat who learns to fly" } + }); + + // ๐ŸŽ‰ Watch as the story and comic panels are generated + for await (const transition of client.executions.transitions.stream(execution.id)) { + console.log(transition); + } + + // ๐Ÿ“ฆ Once the execution is finished, retrieve the results + const result = await client.executions.get(execution.id); + return result; +} + +async function chatWithAgent(agent) { + const session = await client.sessions.create({ agent_id: agent.id }); + + // ๐Ÿ’ฌ Send messages to the agent + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout + }); + + const chat = async () => { + rl.question("Enter a message (or 'quit' to exit): ", async (message) => { + if (message.toLowerCase() === 'quit') { + rl.close(); + return; + } + + const response = await client.sessions.chat(session.id, { message }); + console.log(response); + chat(); + }); + }; + + chat(); +} + +// Run the example +async function runExample() { + const agent = await createAgent(); + const task = await createTask(agent); + const result = await executeTask(task); + console.log("Task Result:", result); + await chatWithAgent(agent); +} + +runExample().catch(console.error); \ No newline at end of file diff --git a/example.py b/example.py index ef6d6f427..1d0e7deda 100644 --- a/example.py +++ b/example.py @@ -1,107 +1,109 @@ -from julep import Julep, AsyncJulep +import yaml +from julep import Julep -# ๐Ÿ”‘ Initialize the Julep client -# Or alternatively, use AsyncJulep for async operations -client = Julep(api_key="your_api_key") +# Initialize the Julep client +client = Julep(api_key="your_julep_api_key") -################## -## ๐Ÿค– Agent ๐Ÿค– ## -################## - -# Create a research agent +# Step 1: Create an Agent agent = client.agents.create( - name="Research Agent", - about="You are a research agent designed to handle research inquiries.", - model="claude-3.5-sonnet", + name="Storytelling Agent", + model="gpt-4", + about="You are a creative storytelling agent that can craft engaging stories and generate comic panels based on ideas.", ) -# ๐Ÿ” Add a web search tool to the agent +# Add an image generation tool (DALLยทE) to the agent client.agents.tools.create( agent_id=agent.id, - name="web_search", # Should be python valid variable name - description="Use this tool to research inquiries.", + name="image_generator", + description="Use this tool to generate images based on descriptions.", integration={ - "provider": "brave", - "method": "search", + "provider": "dalle", + "method": "generate_image", "setup": { - "api_key": "your_brave_api_key", + "api_key": "your_openai_api_key", }, }, ) -################# -## ๐Ÿ’ฌ Chat ๐Ÿ’ฌ ## -################# +# Step 2: Create a Task that generates a story and comic strip +task_yaml = """ +name: Story and Comic Creator +description: Create a story based on an idea and generate a 4-panel comic strip illustrating the story. -# Start an interactive chat session with the agent -session = client.sessions.create( - agent_id=agent.id, - context_overflow="adaptive", # ๐Ÿง  Julep will dynamically compute the context window if needed -) +main: + # Step 1: Generate a story and outline into 4 panels + - prompt: + - role: system + content: You are {{agent.name}}. {{agent.about}} + - role: user + content: > + Based on the idea '{{_.idea}}', write a short story suitable for a 4-panel comic strip. + Provide the story and a numbered list of 4 brief descriptions for each panel illustrating key moments in the story. + unwrap: true -# ๐Ÿ”„ Chat loop -while (user_input := input("You: ")) != "exit": - response = client.sessions.chat( - session_id=session.id, - message=user_input, - ) + # Step 2: Extract the panel descriptions and story + - evaluate: + story: _.split('1. ')[0].strip() + panels: re.findall(r'\\d+\\.\\s*(.*?)(?=\\d+\\.\\s*|$)', _) + + # Step 3: Generate images for each panel using the image generator tool + - foreach: + in: _.panels + do: + tool: image_generator + arguments: + description: _ - print("Agent: ", response.choices[0].message.content) + # Step 4: Generate a catchy title for the story + - prompt: + - role: system + content: You are {{agent.name}}. {{agent.about}} + - role: user + content: > + Based on the story below, generate a catchy title. + Story: {{outputs[1].story}} + unwrap: true -################# -## ๐Ÿ“‹ Task ๐Ÿ“‹ ## -################# + # Step 5: Return the story, the generated images, and the title + - return: + title: outputs[3] + story: outputs[1].story + comic_panels: "[output.image.url for output in outputs[2]]" +""" -# Create a recurring research task for the agent task = client.tasks.create( agent_id=agent.id, - name="Research Task", - description="Research the given topic every 24 hours.", - # - # ๐Ÿ› ๏ธ Task specific tools - tools=[ - { - "name": "send_email", - "description": "Send an email to the user with the results.", - "api_call": { - "method": "post", - "url": "https://api.sendgrid.com/v3/mail/send", - "headers": {"Authorization": "Bearer YOUR_SENDGRID_API_KEY"}, - }, - } - ], - # - # ๐Ÿ”ข Task main steps - main=[ - # - # Step 1: Research the topic - { - # `_` (underscore) variable refers to the previous step's output - # Here, it points to the topic input from the user - "prompt": "Look up topic '{{_.topic}}' and summarize the results.", - "tools": [{"ref": {"name": "web_search"}}], # ๐Ÿ” Use the web search tool from the agent - "unwrap": True, - }, - # - # Step 2: Send email with research results - { - "tool": "send_email", - "arguments": { - "subject": "Research Results", - "body": "'Here are the research results for today: ' + _.content", - "to": "inputs[0].email", # Reference the email from the user's input - }, - }, - # - # Step 3: Wait for 24 hours before repeating - {"sleep": "24 * 60 * 60"}, - ], + **yaml.safe_load(task_yaml) ) -# ๐Ÿš€ Start the recurring task -client.executions.create(task_id=task.id, input={"topic": "Python"}) +# Step 3: Execute the Task +execution = client.executions.create( + task_id=task.id, + input={"idea": "A cat who learns to fly"} +) + +# Watch as the story and comic panels are generated +for transition in client.executions.transitions.stream(execution_id=execution.id): + print(transition) + +# Once the execution is finished, retrieve the results +result = client.executions.get(execution_id=execution.id) +print("Task Result:", result) + +# Step 4: Chat with the Agent +session = client.sessions.create(agent_id=agent.id) + +# Send messages to the agent +while True: + message = input("Enter a message (or 'quit' to exit): ") + if message.lower() == 'quit': + break + + response = client.sessions.chat( + session_id=session.id, + message=message, + ) + print("Agent:", response.choices[0].message.content) -# ๐Ÿ” This will run the task every 24 hours, -# research for the topic "Python", and -# send the results to the user's email +print("Chat session ended.") diff --git a/example.ts b/example.ts index 3ef4e1a91..df795dd5e 100644 --- a/example.ts +++ b/example.ts @@ -1,117 +1,149 @@ -import Julep from '@julep/sdk'; - -// ๐Ÿ”‘ Initialize the Julep client -const client = new Julep({ - apiKey: 'your_api_key', - environment: 'production', // or 'dev' | 'local_multi_tenant' | 'local' -}); - -async function main() { - /* - * ๐Ÿค– Agent ๐Ÿค– - */ - - // Create a research agent - const agent = await client.agents.createOrUpdate('dad00000-0000-4000-a000-000000000000', { - name: 'Research Agent', - about: 'You are a research agent designed to handle research inquiries.', - model: 'claude-3.5-sonnet', +import { Julep } from '@julep/sdk'; +import yaml from 'js-yaml'; +import readline from 'readline'; + +// Add these type declarations at the top of the file +declare module '@julep/sdk'; +declare module 'js-yaml'; + +const client = new Julep({ apiKey: 'your_julep_api_key' }); + +interface Agent { + id: string; + // Add other properties as needed +} + +interface Task { + id: string; + // Add other properties as needed +} + +interface Execution { + id: string; + // Add other properties as needed +} + +async function createAgent(): Promise { + const agent = await client.agents.create({ + name: "Storytelling Agent", + model: "gpt-4", + about: "You are a creative storytelling agent that can craft engaging stories and generate comic panels based on ideas.", }); - // ๐Ÿ” Add a web search tool to the agent + // ๐Ÿ› ๏ธ Add an image generation tool (DALLยทE) to the agent await client.agents.tools.create(agent.id, { - name: 'web_search', - description: 'Use this tool to research inquiries.', + name: "image_generator", + description: "Use this tool to generate images based on descriptions.", integration: { - provider: 'brave', - method: 'search', + provider: "dalle", + method: "generate_image", setup: { - api_key: 'your_brave_api_key', + api_key: "your_openai_api_key", }, }, }); - /* - * ๐Ÿ’ฌ Chat ๐Ÿ’ฌ - */ + return agent; +} - // Start an interactive chat session with the agent - const session = await client.sessions.create({ - agentId: agent.id, - contextOverflow: 'adaptive', /* ๐Ÿง  Julep will dynamically compute the context window if needed */ - }); +const taskYaml = ` +name: Story and Comic Creator +description: Create a story based on an idea and generate a 4-panel comic strip illustrating the story. + +main: + # Step 1: Generate a story and outline into 4 panels + - prompt: + - role: system + content: You are {{agent.name}}. {{agent.about}} + - role: user + content: > + Based on the idea '{{_.idea}}', write a short story suitable for a 4-panel comic strip. + Provide the story and a numbered list of 4 brief descriptions for each panel illustrating key moments in the story. + unwrap: true + + # Step 2: Extract the panel descriptions and story + - evaluate: + story: _.split('1. ')[0].trim() + panels: _.match(/\\d+\\.\\s*(.*?)(?=\\d+\\.\\s*|$)/g) + + # Step 3: Generate images for each panel using the image generator tool + - foreach: + in: _.panels + do: + tool: image_generator + arguments: + description: _ + + # Step 4: Generate a catchy title for the story + - prompt: + - role: system + content: You are {{agent.name}}. {{agent.about}} + - role: user + content: > + Based on the story below, generate a catchy title. + + Story: {{outputs[1].story}} + unwrap: true + + # Step 5: Return the story, the generated images, and the title + - return: + title: outputs[3] + story: outputs[1].story + comic_panels: outputs[2].map(output => output.image.url) +`; + +async function createTask(agent: Agent): Promise { + const task = await client.tasks.create(agent.id, yaml.load(taskYaml)); + return task; +} - // ๐Ÿ”„ Chat loop - const readline = require('readline').createInterface({ - input: process.stdin, - output: process.stdout, +async function executeTask(task: Task): Promise { + const execution = await client.executions.create(task.id, { + input: { idea: "A cat who learns to fly" } }); - const askQuestion = (query: string) => new Promise((resolve) => readline.question(query, resolve)); + // ๐ŸŽ‰ Watch as the story and comic panels are generated + for await (const transition of client.executions.transitions.stream(execution.id)) { + console.log(transition); + } - while (true) { - const userInput = await askQuestion('You: '); - if (userInput === 'exit') break; + // ๐Ÿ“ฆ Once the execution is finished, retrieve the results + const result = await client.executions.get(execution.id); + return result; +} - const response = await client.sessions.chat(session.id, { - message: userInput, - }); +async function chatWithAgent(agent: Agent): Promise { + const session = await client.sessions.create({ agent_id: agent.id }); - console.log('Agent: ', response.choices[0].message.content); - } - - readline.close(); - - /* - * ๐Ÿ“‹ Task ๐Ÿ“‹ - */ - - // Create a recurring research task for the agent - const task = await client.tasks.create(agent.id, { - name: 'Research Task', - description: 'Research the given topic every 24 hours.', - /* ๐Ÿ› ๏ธ Task specific tools */ - tools: [ - { - name: 'send_email', - description: 'Send an email to the user with the results.', - apiCall: { - method: 'post', - url: 'https://api.sendgrid.com/v3/mail/send', - headers: { Authorization: 'Bearer YOUR_SENDGRID_API_KEY' }, - }, - }, - ], - /* ๐Ÿ”ข Task main steps */ - main: [ - // Step 1: Research the topic - { - prompt: "Look up topic '{{_.topic}}' and summarize the results.", - tools: [{ ref: { name: 'web_search' } }], /* ๐Ÿ” Use the web search tool from the agent */ - unwrap: true, - }, - // Step 2: Send email with research results - { - tool: 'send_email', - arguments: { - subject: 'Research Results', - body: "'Here are the research results for today: ' + _.content", - to: 'inputs[0].email', // Reference the email from the user's input - }, - }, - // Step 3: Wait for 24 hours before repeating - { sleep: 24 * 60 * 60 }, - ], + // ๐Ÿ’ฌ Send messages to the agent + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout }); - // ๐Ÿš€ Start the recurring task - await client.executions.create(task.id, { input: { topic: 'TypeScript' } }); + const chat = async () => { + rl.question("Enter a message (or 'quit' to exit): ", async (message) => { + if (message.toLowerCase() === 'quit') { + rl.close(); + return; + } + + const response = await client.sessions.chat(session.id, { message }); + console.log(response); + chat(); + }); + }; + + chat(); +} - /* - * ๐Ÿ” This will run the task every 24 hours, - * research for the topic "TypeScript", and - * send the results to the user's email - */ +// Run the example +async function runExample() { + const agent = await createAgent(); + const task = await createTask(agent); + const result = await executeTask(task); + console.log("Task Result:", result); + await chatWithAgent(agent); } -main().catch(console.error); \ No newline at end of file +runExample().catch(console.error); \ No newline at end of file diff --git a/sdks/node-sdk b/sdks/node-sdk index 2685cfe51..6ff96ce85 160000 --- a/sdks/node-sdk +++ b/sdks/node-sdk @@ -1 +1 @@ -Subproject commit 2685cfe512d6b2907e6bdd1b3294175e20aece99 +Subproject commit 6ff96ce8599538291aeb242e6d11650f2c490616 diff --git a/sdks/python-sdk b/sdks/python-sdk index aaa88a204..3d763379e 160000 --- a/sdks/python-sdk +++ b/sdks/python-sdk @@ -1 +1 @@ -Subproject commit aaa88a204bb85b7903f79b8fb5cca0c3e6882c73 +Subproject commit 3d763379e986b38a9d7f24b99f7f6211f19591a0