Skip to content

Commit

Permalink
docs: update site docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Oct 24, 2024
1 parent 6a408b2 commit 7994f15
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 308 deletions.
44 changes: 3 additions & 41 deletions how-tos/src/site/markdown/adaptiverag.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,5 @@
# Adaptive RAG

<!--
```java
String userHomeDir = System.getProperty("user.home");
String localRespoUrl = "file://" + userHomeDir + "/.m2/repository/";
String langchain4jVersion = "0.35.0"
```
```java
%dependency /add-repo local \{localRespoUrl} release|never snapshot|always
%dependency /list-repos
```
```java
%dependency /add org.slf4j:slf4j-jdk14:2.0.9
%dependency /add org.bsc.langgraph4j:langgraph4j-core-jdk8:1.0-SNAPSHOT
%dependency /add org.bsc.langgraph4j:langgraph4j-langchain4j:1.0-SNAPSHOT
%dependency /add dev.langchain4j:langchain4j:\{langchain4jVersion}
%dependency /add dev.langchain4j:langchain4j-open-ai:\{langchain4jVersion}
%dependency /resolve
```
## Initialize Logger
```java
try( var file = new java.io.FileInputStream("./logging.properties")) {
var lm = java.util.logging.LogManager.getLogManager();
lm.checkAccess();
lm.readConfiguration( file );
}
var log = org.slf4j.LoggerFactory.getLogger("AdaptiveRag");
```
-->

## Test Issue [#32](https://github.com/bsorrentino/langgraph4j/issues/32)

Expand Down Expand Up @@ -136,7 +98,7 @@ grader.apply( args );

```

2024-10-11 12:53:02 FINEST REPL.$JShell$20$AnswerGrader apply prompt: User question:
2024-10-24 16:56:26 FINEST REPL.$JShell$20$AnswerGrader apply prompt: User question:

What are the four operations ?

Expand All @@ -160,7 +122,7 @@ grader.apply( args );

```

2024-10-11 12:53:03 FINEST REPL.$JShell$20$AnswerGrader apply prompt: User question:
2024-10-24 16:56:28 FINEST REPL.$JShell$20$AnswerGrader apply prompt: User question:

What are the four operations

Expand All @@ -184,7 +146,7 @@ grader.apply( args );

```

2024-10-11 12:53:05 FINEST REPL.$JShell$20$AnswerGrader apply prompt: User question:
2024-10-24 16:56:29 FINEST REPL.$JShell$20$AnswerGrader apply prompt: User question:

What player at the Bears expected to draft first in the 2024 NFL draft?

Expand Down
188 changes: 67 additions & 121 deletions how-tos/src/site/markdown/agentexecutor.md

Large diffs are not rendered by default.

51 changes: 13 additions & 38 deletions how-tos/src/site/markdown/persistence.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,7 @@ When creating any LangGraph workflow, you can set them up to persist their state
[`Checkpointer`]: https://bsorrentino.github.io/langgraph4j/apidocs/org/bsc/langgraph4j/checkpoint/Checkpoint.html
[`MemorySaver`]: https://bsorrentino.github.io/langgraph4j/apidocs/org/bsc/langgraph4j/checkpoint/MemorySaver.html

<!--
```java
String userHomeDir = System.getProperty("user.home");
String localRespoUrl = "file://" + userHomeDir + "/.m2/repository/";
String langchain4jVersion = "0.35.0"
```
```java
%dependency /add-repo local \{localRespoUrl} release|never snapshot|always
%dependency /list-repos
```
```java
%dependency /add org.bsc.langgraph4j:langgraph4j-core-jdk8:1.0-SNAPSHOT
%dependency /add org.bsc.langgraph4j:langgraph4j-langchain4j:1.0-SNAPSHOT
%dependency /add dev.langchain4j:langchain4j:\{langchain4jVersion}
%dependency /add dev.langchain4j:langchain4j-open-ai:\{langchain4jVersion}

%dependency /resolve
```
### Initialize Logger
```java
var lm = java.util.logging.LogManager.getLogManager();
lm.checkAccess();
try( var file = new java.io.FileInputStream("./logging.properties")) {
lm.readConfiguration( file );
}
```
-->

## Define the state

State is an (immutable) data class, inheriting from [`AgentState`], shared with all nodes in our graph. A state is basically a wrapper of a `Map<String,Object>` that provides some enhancers:
Expand Down Expand Up @@ -122,10 +88,19 @@ stateSerializer.mapper()

```

SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details.





org.bsc.langgraph4j.serializer.std.SerializerMapper@3748372b
SerializerMapper:
java.util.Map
java.util.Collection
dev.langchain4j.agent.tool.ToolExecutionRequest
dev.langchain4j.data.message.ChatMessage



Expand Down Expand Up @@ -222,7 +197,7 @@ AiMessage aiMessage = response.content();
System.out.println( aiMessage );
```

AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = "call_Pr6dnlhKtSPCvMbS2H7JnNnw", name = "execQuery", arguments = "{"query":"London weather forecast for tomorrow"}" }] }
AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = "call_iwuCGVWzra6NNpEvTYUVW3qX", name = "execQuery", arguments = "{"query":"London weather forecast for tomorrow"}" }] }


## Define the graph
Expand Down Expand Up @@ -316,7 +291,7 @@ for( var r : result ) {

__START__
agent
{messages=[AiMessage { text = "Hi I'm Bartolo, niced to meet you." toolExecutionRequests = null }, AiMessage { text = "Nice to meet you too, Bartolo! How can I assist you today?" toolExecutionRequests = null }]}
{messages=[AiMessage { text = "Hi I'm Bartolo, niced to meet you." toolExecutionRequests = null }, AiMessage { text = "Hello Bartolo! Nice to meet you too. How can I assist you today?" toolExecutionRequests = null }]}
__END__


Expand Down Expand Up @@ -441,6 +416,6 @@ for( var r : result ) {
__START__
agent
AiMessage { text = "I don't know your name unless you tell me. If you'd like to share it or if there's anything specific you'd like to discuss, feel free to let me know!" toolExecutionRequests = null }
AiMessage { text = "No, I don't know your name. I don't have access to personal data about individuals unless it has been shared with me in the course of our conversation. If you have any questions or need assistance, feel free to ask!" toolExecutionRequests = null }
__END__
11 changes: 1 addition & 10 deletions how-tos/src/site/markdown/plantuml.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
```java
%dependency /add net.sourceforge.plantuml:plantuml-mit:1.2024.6
%dependency /resolve
```

# PlantUML

```java
import net.sourceforge.plantuml.SourceStringReader;
Expand Down Expand Up @@ -46,8 +42,3 @@ display( plantUML2PNG( code ) );





525f8598-3e57-461c-adc2-e6a309cce3d3


Loading

0 comments on commit 7994f15

Please sign in to comment.