bergr7f commited on
Commit
d429c1c
·
verified ·
1 Parent(s): 2a98223

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +29 -13
README.md CHANGED
@@ -67,29 +67,45 @@ pip install -e ".[vllm]"
67
 
68
  Quickstart with Python:
69
  ```python
70
- from flow_judge.models.model_factory import ModelFactory
71
- from flow_judge.flow_judge import EvalInput, FlowJudge
72
- from flow_judge.metrics import RESPONSE_CORRECTNESS_BINARY
73
  from IPython.display import Markdown, display
74
 
75
- # Create a model using ModelFactory
76
- model = ModelFactory.create_model("Flow-Judge-v0.1-AWQ")
 
 
 
 
 
 
77
 
78
  # Initialize the judge
79
- judge = FlowJudge(
80
- metric=RESPONSE_CORRECTNESS_BINARY,
81
  model=model
82
  )
83
 
84
- # Prepare evaluation input
 
 
 
 
 
 
85
  eval_input = EvalInput(
86
- inputs=[{"question": "What is the capital of France?"}],
87
- output="The capital of France is Paris."
 
 
 
88
  )
89
 
90
- # Perform evaluation
91
- result = judge.evaluate(eval_input)
92
- print(result)
 
 
93
  ```
94
 
95
  Discover more at our repository [https://github.com/flowaicom/flow-judge](https://github.com/flowaicom/flow-judge)
 
67
 
68
  Quickstart with Python:
69
  ```python
70
+ from flow_judge import Vllm, Llamafile, Hf, EvalInput, FlowJudge
71
+ from flow_judge.metrics import RESPONSE_FAITHFULNESS_5POINT
 
72
  from IPython.display import Markdown, display
73
 
74
+ # If you are running on an Ampere GPU or newer, create a model using VLLM
75
+ model = Vllm(quantization=True)
76
+
77
+ # If you have other applications open taking up VRAM, you can use less VRAM by setting gpu_memory_utilization to a lower value.
78
+ # model = Vllm(gpu_memory_utilization=0.70)
79
+
80
+ # Or create a model using Llamafile if not running an Nvidia GPU & running a Silicon MacOS for example
81
+ # model = Llamafile()
82
 
83
  # Initialize the judge
84
+ faithfulness_judge = FlowJudge(
85
+ metric=RESPONSE_FAITHFULNESS_5POINT,
86
  model=model
87
  )
88
 
89
+ # Sample to evaluate
90
+ query = ...
91
+ context = ...
92
+ response = ...
93
+
94
+ # Create an EvalInput
95
+ # We want to evaluate the response to the customer issue based on the context and the user instructions
96
  eval_input = EvalInput(
97
+ inputs=[
98
+ {"query": query},
99
+ {"context": context},
100
+ ],
101
+ output={"response": response},
102
  )
103
 
104
+ # Run the evaluation
105
+ result = faithfulness_judge.evaluate(eval_input, save_results=False)
106
+
107
+ # Display the result
108
+ display(Markdown(f"__Feedback:__\n{result.feedback}\n\n__Score:__\n{result.score}"))
109
  ```
110
 
111
  Discover more at our repository [https://github.com/flowaicom/flow-judge](https://github.com/flowaicom/flow-judge)